Install WordPress on Linux

Categories:

You have your Linux server with Apache, PHP and MySQL setup?
You just need to install WordPress now 🙂

First thing, let’s get the code:

cd /var/www/your-site-directory
wget https://wordpress.org/latest.tar.gz

Let’s unpack it in the site’s directory:

sudo tar -xzf latest.tar.gz

The files are in a directory called wordpress. You may want to move the files to your site’s root:

cd wordpress
sudo mv * ..

Set the correct privileges to the files from the archive:

find /var/www/your-site-directory -type d -exec chmod 755 {} \;
find /var/www/your-site-directory -type f -exec chmod 644 {} \;
chown -R www-data:www-data /var/www/your-site-directory

WordPress needs access to a MySQL database, so let’s connect to MySQL and create a dabatase and a user:

mysql -u root -p
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'my-secret-password';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
quit

Now visit the website in a browser to enter the final configuration step. You will need to enter the Database Name, Username and Password and run the installation.

Now you can start blogging. Choose a nice topic!

Leave a Reply

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