WordPress Install on Ubuntu 16.04 and CentOS 7
Download the latest WordPress package and extract it:
$ cd /tmp $ wget -c http://wordpress.org/latest.tar.gz $ tar xvzf latest.tar.gz
This will create a WordPress package in wordpress.
Let's move the WordPress files from the extracted folder to the Apache root directory for our domain (bojima.com), /var/www/html/bojima:
$ sudo rsync -av wordpress/* /var/www/html/bojima
Let's set the correct permission/ownership on the directory.
Ubuntu 16:
$ sudo chown -R www-data:www-data /var/www/html/bojima $ sudo chmod -R 755 /var/www/html/bojima
CentOS 7:
$ sudo chown -R apache:www-data /var/www/html/bojima $ sudo chmod -R 755 /var/www/html/bojima
We want to set the name, user, and password for database:
$ mysql -u root -p mysql> create database wp_blog; mysql> GRANT ALL PRIVILEGES ON wp_blog.* TO 'username'@'localhost' IDENTIFIED BY 'password'; mysql> flush privileges; mysql> exit;
Go the /var/www/html/bojima directory and rename existing wp-config-sample.php to wp-config.php:
$ sudo cp wp-config-sample.php wp-config.php
We may need to update it with our database information under the MySQL settings section:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'database_name'); /** MySQL database username */ define('DB_USER', 'username'); /** MySQL database password */ define('DB_PASSWORD', 'password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', '');
Here is the configuration file (/etc/apache2/sites-available/bojima.example.com.conf) on a local machine:
<VirtualHost *:80> ServerName www.bojima.example.com ServerAlias bojima.example.com ErrorLog /var/www/bojima.example.com/logs/error.log CustomLog /var/www/bojima.example.com/logs/access.log combined LogLevel warn DirectoryIndex index.php DocumentRoot /var/www/html/bojima ServerSignature Off <Directory /var/www/html/bojima> AllowOverride All </Directory> </VirtualHost>
Another configuration file (/etc/httpd/sites-available/bojima.com.conf) on a production server:
<VirtualHost *:80> ServerName www.bojima.com ServerAlias bojima.com ErrorLog /var/www/bojima.com/logs/error.log CustomLog /var/www/bojima.com/logs/access.log combined LogLevel warn DirectoryIndex index.php DocumentRoot /var/www/html/bojima ServerSignature Off <Directory /var/www/html/bojima> AllowOverride All </Directory> </VirtualHost>
Restart the web server and mysql service.
Ubuntu 14.04:
$ sudo a2ensite bojima.example.com.conf $ sudo systemctl restart apache2.service $ sudo systemctl restart mysql.service
CentOS 7:
$ sudo ln -s /etc/httpd/sites-available/bojima.com.conf /etc/httpd/sites-enabled/bojima.com.conf $ sudo systemctl restart mariadb $ $ sudo systemctl restart httpd
Open a web browser, then enter : http://bojima.example.com (local)to get the welcome page as shown below:
On a production server (CentOS 7), type in http://bojima.com:
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization