CentOS 7 server setup memo

Install basic software

# yum -y install httpd php php-mbstring php-pgsql
# systemctl start httpd
# systemctl enable httpd

Set firewall

sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=ssh --permanent
sudo firewall-cmd --zone=public --add-port=12345/tcp --permanent
sudo firewall-cmd --zone=public --remove-port=12345/tcp --permanent
sudo firewall-cmd --reload

Config Apache VirtualHost

Need “Require all granted”

Example

<VirtualHost www.example.com:80>
  ServerName www.example.com
  DocumentRoot /home/web/www.example.com
  ErrorLog "logs/www.example.com-error.log"
  CustomLog "logs/www.example.com-access.log" common

  <Directory "/home/web/www.example.com/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

Install and setup PostgreSQL

# yum -y install postgresql-server
# postgresql-setup initdb
# Edit /var/lib/pgsql/data/pg_hba.conf, add necessary connection.
# service postgresql start
# systemctl enable postgresql

Install and setup MariaDB (MySQL)

# yum -y install mariadb-server mariadb
# systemctl start mariadb
# systemctl enable mariadb

Change hostname

hostnamectl set-hostname myserver.webplay.pro
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: