Tutorial

How To Install Wordpress on Arch Linux

Published on September 19, 2012
How To Install Wordpress on Arch Linux

About Wordpress

Wordpress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality.

Setup

The steps in this tutorial require the user to have root privileges. You can see how to set that up here in steps 3 and 4.

Before working with wordpress, you need to have LAMP installed on your server. If you don't have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up here.

Once you have the user and required software, you can start installing wordpress!

Step One—Download WordPress

Make sure that wget is installed on your server:

sudo pacman -S wget

We can download Wordpress straight from their website:

wget http://wordpress.org/latest.tar.gz

This command will download the zipped wordpress package straight to your user's home directory. You can unzip it the the next line:

tar -xzvf latest.tar.gz 

Step Two—Create the WordPress Database and User

After we unzip the wordpress files, they will be in a directory called wordpress in the home directory.

Now we need to switch gears for a moment and create a new MySQL directory for wordpress.

Go ahead and log into the MySQL Shell:

mysql -u root -p

Login using your MySQL root password, and then we need to create a wordpress database, a user in that database, and give that user a new password. Keep in mind that all MySQL commands must end with semi-colon.

First, let's make the database (I'm calling mine wordpress for simplicity's sake; feel free to give it whatever name you choose):

CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:

CREATE USER wordpressuser@localhost;
Query OK, 0 rows affected (0.00 sec)

Set the password for your new user:

SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");
Query OK, 0 rows affected (0.00 sec)

Finish up by granting all privileges to the new user. Without this command, the wordpress installer will not be able to start up:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

Then refresh MySQL:

FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Exit out of the MySQL shell:

exit

Step Three—Setup the WordPress Configuration

The first step to is to copy the sample wordpress configuration file, located in the wordpress directory, into a new file which we will edit, creating a new usable wordpress config:

cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Then open the wordpress config:

sudo nano ~/wordpress/wp-config.php

Find the section that contains the field below and substitute in the correct name for your database, username, and password:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

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

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

Save and Exit.

Step Four—Copy the Files

We are almost done uploading Wordpress to the server. The final move that remains is to transfer the unzipped WordPress files to the website's root directory.

sudo cp -r ~/wordpress/* /srv/http/

Additionally, make sure that PHP can connect to MySQL. Open up the php.ini file:

sudo nano /etc/php/php.ini

Find the line and remove the semi-colon:

;extension=mysql.so

The line should now look like this:

extension=mysql.so

Restart Apache:

sudo /etc/rc.d/httpd restart

UPDATE: Since the introduction of systemd, the proper way of restarting Apache is by running the following command:

sudo systemctl restart httpd

From here, WordPress has its own easy to follow installation form online.

Step Five—RESULTS: Access the WordPress Installation

Once that is all done, the wordpress online installation page is up and waiting for you:

Access the page by adding /wp-admin/install.php to your site's domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form (it should look like this).

By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I feel really late coming lol only learned about Arch recently and surprised this tutorial from 9 years old already.

What about permision when upgrade, install themes, plugin ? Does it must be asign ownership for www-data user (group) as on debian/ubuntu?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
January 30, 2014

@1triberadio: Did you follow all of the article? If so, it should be in <code>/srv/http/</code>. What’s your droplet’s IP address?

i installed my WP as stated in the instruction, the only problem is it installed in ~root/wordpress and i dont have a Public_html folder so now i cant access my website. can you help with what to do? Thanks

I have found that if you want permalinks to work you have to change AllowOverride from None to All in the DocumentRoot section (the one starting with <Directory “/srv/http”>). If you don’t enable this option, you get an apache 404 error.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
September 3, 2013

@sk8ingdom: It depends where you installed it. If you followed this article, it should be installed in ~/wordpress.

Thanks for the tutorial! I just did this last night. As a general question, is there any reason wordpress lives (for me) in /usr/share/webapps/wordpress rather an ~/user/public_html? What would be the easiest way to modify this?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
August 13, 2013

@adjema: <pre>chmod -R 777 /srv/http/wp-content/uploads</pre>

what about permissions for uploading files etc ?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
May 16, 2013

Thanks @mogi57, updated the article.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.