Already installed LAMP or LEMP (Nginx with PHP, Mysql) on your Ubuntu Server? This time I’m going to show you how to install WordPress CMS.
WordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It’s free and open-source.
To install WordPress, first login your Ubuntu Server as root, then follow the steps below:
1.) Create Mysql Database and User for WordPress.
-
- First log into Mysql as root user:
mysql -u root -p
- First log into Mysql as root user:
Type in the root password to get past.
- Create a database. Change database-name in code to whatever you want.
CREATE DATABASE database-name;
- Create an user. Change database-user in code to whatever you want.
CREATE USER database-user@localhost;
- Give a password to the user just created. Change password-here in code.
SET PASSWORD FOR database-user@localhost= PASSWORD("password-here");
- Grant all privileges to the new user.
GRANT ALL PRIVILEGES ON database-name.* TO database-user@localhost IDENTIFIED BY 'password-here';
- f.) Finally, refresh Mysql:
FLUSH PRIVILEGES;
- g.) Exit Mysql sell
exit
2.) Download WordPress and setup the configuration.
- Download the latest wordpress:
wget http://wordpress.org/latest.tar.gz
Then extract:
tar -xzvf latest.tar.gz
- Copy the sample configuration file to make a backup.
cd wordpress && cp wp-config-sample.php wp-config.php
- Edit the configuration file:
vi wp-config.php
Press I to start editing, Esc to stop editing. Press :, then type wq to save and exit, type q! to exit without save.
Then change the section of database-name, database-user, password-here.
// ** 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’, ‘database-user’);/** MySQL database password */
define(‘DB_PASSWORD’, ‘password-here’);
3.) Setup the permissions.
-
- Give ownership of the directory to the apache or nginx user by running following commands one by one:
sudo rsync -avP ~/wordpress/ /var/www/ cd /var/www/ sudo chown www-data:www-data * -R sudo usermod -a -G www-data username
4.) Finally in your browser go to IP or domain/wp-admin/install.php and start installing.
Enjoy!
I follow this tutorial for installing wordpress in my vps. I don’t get any error while installing. After all process when I go to my-ip/wp-admin/install.php I get a not found message.
It says: The requested URL /wp-admin/install.php was not found on this server.
Plz give me a solution.
You need one more step to copy the files:
If you use the nginx as the web server, you may change the /var/www/ directory
For the last part:
sudo usermod -a -G www-data username
What user is this in your example?
It’s the name you specified for your web server. default is www-data.
its mean “root”
sudo usermod -a -G www-data root
its a default username