How to build a web server from a blank centos7?

centos update

  • yum install -y epel-release yum-utils
  • yum-config-manager --enable epel
  • yum clean all && sudo yum update -y
  • yum update -y
  • yum groupinstall "Development Tools"
  • yum install zlib-devel wget openssl-devel pcre pcre-devel readline-devel
  • yum install git
  • yum install pgsql 9.6
  • yum install nodejs

install Passenger packages

enable the Passenger Nginx module and restart Nginx

Edit /etc/nginx/conf.d/passenger.conf and uncomment passenger_root, passenger_ruby and passenger_instance_registry_dir. For example, you may see this

  • passenger_root /some-filename/locations.ini;
  • passenger_ruby /usr/bin/ruby;
  • passenger_instance_registry_dir /var/run/passenger-instreg;

When you are finished with this step, restart Nginx:

  • service nginx restart

check installation

  • /usr/bin/passenger-config validate-install
  • /usr/sbin/passenger-memory-stats

Install rvm

Install ruby

  • rvm install 2.5
  • rvm --default use 2.5.5
  • rvm reload

Install gems

  • gem install bundler
  • gem install rails -v 4.2.10z

Install pgsql 9.6

init db

  • /usr/pgsql-9.6/bin/postgresql96-setup initdb

restart postgresql

  • service postgresql-9.6 restart
  • chkconfig postgresql-9.6 on

Install cube extension

  1. yum install postgresql96-contrib.x86_64
  2. sudo -u postgres psql
  3. postgres=# create extension cube;
  4. postgres=# \dT

Install postgis extension

  1. 下面已經(jīng)postgis9.6 為例,
    yum install postgis2_96-devel.x86_64
  2. sudo -u postgres psql
  3. postgres=# create extension postgis;
  4. postgres=# \dT

Create new user and db

  1. Su - postgres
  2. createuser -s poi_db_admin
  3. createdb -O poi_db_admin poi_db_pro
  4. psql -U poi_db_admin -d poi_db_pro
  5. ALTER USER poi_db_admin WITH PASSWORD ‘Fac';
  6. create user poi_db_admin with password ‘Factr123!';
  7. create database poi_db_pro owner poi_db_admin;
  8. grant all privileges on database poi_db_pro to poi_db_admin;
  9. vi /var/lib/pgsql/9.6/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

create new linux user

  • adduser rails
  • chmod 775 -R /home/rails m
  • usermod -G wheel rails

Deploy source to the server

download source

  • git clone git@github.com:roadlaunch/truckbubbaService.git
  • cd truckbubbaService/
  • git fetch origin rl_dev
  • git checkout rl_dev
  • vi ~/.bash_profile
bundle config build.pg --with-pg-config=/usr/pgsql-9.6/bin/pg_config
bundle install --path vendor/bundle
bundle exec rake db:create RAILS_ENV=production
bundle exec rake db:migrate RAILS_ENV=production
  • cd /etc/nginx/conf.d
  • vi poi_management.conf
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容