Installing Apache Mysql on Centos Ubuntu and creating WordPress website

installing-apache-mysql-centos-ubuntu-creating-wordpress

Installing Apache Mysql on Centos Ubuntu and creating WordPress website

Installing Apache Mysql on Centos Ubuntu and creating WordPress website Once you got the Server or VPS, Login to the server through SSH using a the tool called putty. Once you have logged in. type in the below command. For CentOs : Installing Apache with Mysql support

For Ubuntu

Set the Apache service to start automatically when you restart.

Start the Apache server by service httpd start or /etc/init.d/httpd start Now, we need to install mysql server

On Ubuntu

Set the Mysql service to start automatically when you restart.

Start the Mysql server by service mysqld start or /etc/init.d/mysqld start Once the Apache Webserver and MySql server is installed and started. We need to configure it. Now, Preparing the Apache Web Server. Its simple, if you want to load WordPress or any other script through the IP Address, Just upload the files to /var/www/html and proceed to the MySql configuration process. If you want to host a website and load through a website or domain name. follow the below steps. Just edit the httpd.conf file using nano text editor.

Go to very bottom of the configuration file and add this below lines and replace your domain name instead of example.com.

or you can also create a file called example.com.conf at the path /etc/httpd/conf.d/example.com.conf and paste the above details and save it. Once done, Just restart the Apache server by service httpd restart now, you can access the website through your domain name, eg. http://example.com The Apache setup is complete. We will now prepare the Mysql server. MySql server is installed with no root password set. We will now secure the mysql installation and its sooo easy. Just type : mysql_secure_installation

follow the setup steps after you enter the above command. Just press enter on the first prompt, enter the mysql root users password now. we will now login to the mysql server by below command. after you complete the mysql server secure setup.

Once you logged in with MySQL root password, We need to create database for wordpress installation:

Now wee need to create a new user.

change userpassword with your own pass code. Use Strong Password Generator to get a secure password here http://www.mynetworkip.com/strongsecurepasswordgenerator/ Now, we are going to provide PRIVILEGES to the dbuser on the database we created.

and also flush the privileges

Now, type exit to come out of the mysql prompt. Preparing the WordPress Script to install. Downloading the WordPress Installation Files.

Here, You may get an error like below

To Resolve the issue, Just add –no-check-certificate at the end of the wget command. eg: wget https://wordpress.org/latest.zip –no-check-certificate

Now, You will see a folder called wordpress.

cd wordpress mv -Rf * /var/www/example.com/

This two lines command will move the wordpress files from /wordpress to main domain folder. make sure you change the path with yours. Now, Copy the sample wordpress config file “wp-config-sample.php” from the wordpress directory to “wp-config.php”

Edit the the file wp-config.php using nano text editor.

You will find this below details on the php file, make sure you update with your mysql credentials. /** The name of the database for WordPress */ define(‘DB_NAME’, ‘WordPressdb’); /**MySQL database exampledb */ define(‘DB_USER’, ‘databaseuser’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘userpassword’); Save it by Pressing “CTRL + O” and Exit by Pressing “CTRL + X“. Now, access the wordpress URL, http://youripaddress/wp-admin/install.php or http://example.com/wp-admin/install.php OPTIONAL : Set the permissions on the installation directory. First, switch in to the web directory: [email protected] # cd /var/www/ Give ownership of the directory sudo chown www-data:www-data * -R sudo usermod -a -G www-data username If this guide helpful, help us sharing this to your friends in need of help.

Comments