Setting Up WordPress in your own Server

Download and extract WordPress


tar -xzvf latest.tar.gz

Create a database and a user and link that to your WordPress

You can use either MySQL database or MariaDB as a backend for your WordPress. In this tutorial, I’ll show using MySQL.

# . Install mysql

sudo apt-get install mysql-server

# Note: the root password can be found in /etc/mysql/debian.cnf in Ubuntu

Next, log into your mysql-server using mysql-client and create a database and a user for wordpress

mysql -u root -p root_password

mysql> CREATE DATABASE wordpressdb1;
mysql> GRANT ALL PRIVILEGES ON databasename.* TO "wordpressdb1user"@"%"
-> IDENTIFIED BY "wordpressdb1user_pass"; 

Now, link the database to wordpress by copying wp-config-sample.php to wp-config.php and editing it as follows:

define( 'DB_NAME', 'wordpressdb1' );

/** MySQL database username */
 define( 'DB_USER', 'wordpressdb1user' );

/** MySQL database password */
define( 'DB_PASSWORD', 'wordpressdb1user_pass' );

Install Php and Apache2

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

sudo apt-get install apache2

Install WordPress

When you have apache2 server, the http files are served from /var/www/html/ folder. Move all the files and folder of wordpress to this folder and restart apache2 server by running the command sudo service apache2 restart

Now, point your browser to http://ip-address-of-your-machine/wp-admin/install.php and the wordpress installation will start.

Leave a Reply

Your email address will not be published. Required fields are marked *