June 28, 2012

Beginner

How To Install Wordpress on Ubuntu 12.04

Tagged In: Ubuntu, Word Press

What the Red Means

The lines that the user needs to enter or customize will be in red in this tutorial!

The rest should mostly be copy-and-pastable.

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 in the Initial Server Setup.

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

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

Step One—Download WordPress


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 virtual private server. The final move that remains is to transfer the unzipped WordPress files to the website's root directory.
sudo rsync -avP ~/wordpress/ /var/www/

Finally we need to set the permissions on the installation. First, switch in to the web directory:
cd /var/www/

Give ownership of the directory to the apache user.
sudo chown username:www-data /var/www -R 
sudo chmod g+w /var/www -R 

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

However, the form does require a specific php module to run. If it is not yet installed on your server, download php-gd:
sudo apt-get install php5-gd

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).

See More


Once Wordpress is installed, you have a strong base for building your site.

If you want to encrypt the information on your site, you can Install an SSL Certificate



By Etel Sverdlov

Share this Tutorial

Vote on Hacker News

Try this tutorial on an SSD cloud server.

Includes 512MB RAM, 20GB SSD Disk, and 1TB Transfer for $5/mo! Learn more

Create an account or login:

114 Comments

Write Tutorial
  • Gravatar James Tansley over 1 year

    Excellent tutorial. You may need to change the DirectoryIndex when installing Wordpress on a fresh LAMP box so that the index.php file will load. If you point your web browser to your server IP / domain and you only see the "It works" Apache page after installing/configuring Wordpress then you will need to edit the DirectoryIndex so Apache will load index.php as the default webpage. To do this, follow these steps: 1. Go to /etc/apache2/mods-enabled/ directory. To do this, type "cd /etc/apache2/mods-enabled/" without the quotes. 2. Open the dir.conf file so you can edit it. To do this, type "sudo nano dir.conf" without the quotes. 3. You will see a line of index files (index.html, index.php, index.cgi, etc) under the DirectoryIndex setting. Add index.php as the first item in the list. Doing so will tell Apache to first look for and load an index.php file before looking for the other index file extensions. 4. Press Ctrl+X to save your changes and then press Enter to exit the editor. 5. Restart Apache by typing "sudo /etc/init.d/apache2 restart" without the quotes. I followed the above tutorial and found that mysite.com was still showing "It works" after installing Wordpress. I could still access the admin control panel but I was unable to view the blog. Adding index.php as the first file to load in the dir.conf file fixed this issue for me. Hope this helps others as well!

  • Gravatar Ifiok Jr. over 1 year

    I've Just run through this and now getting the error when trying to start up mysql and DB connection error when tryign to access the website. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) Any ideas what could be causing this Not sure what to do... :-S

  • Gravatar Ben Uretsky over 1 year

    It sounds like MySQL server isn't running, hence a connection can not be made. Make sure to install a valid LAMP environment first as detailed in: https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu (L)inux (A)pache (M)ySQL (P)HP If MySQL is properly installed you can start it with: sudo service mysql start If it fails you can review the error log for more details /var/log/mysql.err or /var/log/mysql/error.log

  • Gravatar jdietrichster over 1 year

    Really a fantastic tutorial. I did have to modify dir.conf as suggested above by James Tansley (thanks for that James BTW!!) Can't recommend this enough. Thanks for the hard word!

  • Gravatar Etel Sverdlov over 1 year

    Thank you, and thank you, James! Please let me know if there are any further topics you would like to see covered in our community.

  • Gravatar over 1 year

    Thank You, James Tansley :)))

  • Gravatar azraiyan over 1 year

    I tried to install new plugins but it needs ftp connection, of which is possible only through SSH, correct me if Im wrong. However I tried using Filezilla and managed to transfer the plugins folder to /wp-content/plugins. When I checked them on wordpress, the plugins are not there. Any idea whats the problem.

  • Gravatar Etel Sverdlov over 1 year

    You may be able to install the plugins by temporarily changing the permissions of your web directory to 777 until the plugin is installed. As soon as the plug in has finished installing, the permissions should then be scaled back down to 755.

  • Gravatar Kerem Bozdas about 1 year

    What is the 'username' referred in "sudo usermod -a -G www-data username" line? I'm trying to set up Wordpress on a virtual host so my WP home directory is "/var/www/example.com/public_html". I'm guessing it might be the "demo" user equivalent or maybe something like "www-data" ? I'm lost, I don't want to screw up. :)

  • Gravatar weftech about 1 year

    I keep getting the "usermod : user 'demo' does not exist"

  • Gravatar iesmandau about 1 year

    i can't get the Virtual Host on Apache to parse the .php files. HELP!!!!

  • Gravatar dougquesnel about 1 year

    This is an awesome guide. Most people have you use apt-get, but the permissions end up all wonky and this was so much more straight forward.

  • Gravatar cosmin about 1 year

    WordPress automatic updates + FTP: For anyone that has followed this tutorial to enable automatic WordPress updates by chown-ing the public folder to www-data, if you've setup FTP (i.e. vsftpd), you will notice you will not be able to upload files to that directory by FTP. To have both automatic updates and FTP uploads working, like all us new-comers are used to with a shared host, run this instead (code adapted to this tutorial): sudo chown -R www-data:username /var/www Everything will work as on your ex-shared host: automatic updates, FTP uploads and live file editing, file uploads in WordPress. Maybe this can be added to the tutorial.

  • Gravatar Michael 12 months

    I had an issue with permalinks. Solution ::: 1) Enable Mod Rewrite : sudo a2enmod rewrite 2) Change AllowOverride None to AllowOverride All : sudo nano /etc/apache2/sites-enabled/000-default 3) Restart Apache : sudo /etc/init.d/apache2 restart I trust this will help others.

  • Gravatar gmccray 12 months

    How can I undo this install?

  • Gravatar gmccray 12 months

    I was running multiple websites using virtual hosts and now it has overwritten so that only the wordpress site is working. I copied the files to the /var/www directory and probably should have created another folder within the www folder. I would like to keep wordpress if possible to use it and learn it but need to have the virtual hosts working. For now until I get some help I copied the new files that this install put in the www folder to a new folder within the www folder called wordpress. /var/www/wordpress, my virtual hosts are working but word press is not. any help would be appreciated.

  • Gravatar BeeTall 11 months

    @James Tansley - thanks for the comment on enabling the index.php. After the wordpress install the home page was getting downloaded rather than rendering in the browser. A simple phpinfo() tag in a file by itself worked fine though. So, your trick did make the wordpress site work fine. @Michael - thanks for that comment about enabling the rewrite on apache. If your Permalinks are not working this should do the trick.

  • Gravatar Adam Heward 11 months

    I followed the initial set up guide to create a user and then the LAMP set up and then finally this wordpress set up guide. I logged into wordpress and clicked on the sample post link and the page loaded fine. Went to alter my permalinks and got the message about manually adding the permalinks... Tried to install a plug in and got the ftp information message. Followed cosmin's advice as we as Michael's and now I can update permalinks and install plugins through the dash board but now any other page than my homepage throws up a 404. "The requested URL /2013/05/13/hello-world/ was not found on this server." Any thoughts? I've been pulling my hair out with this, previously I'd dived straight into virtual hosts and was getting these issues. Scaled back to just a simple install and still have the problems.

  • Gravatar Adam Heward 11 months

    I seem to have it working for the root site now. About to embark on making it work with virtual hosts. This guide could really do with the additional steps adding.

  • Gravatar Mr. Spray Artist 11 months

    Also wondering - what would be the changes for wordpress on a server with virtual hosts?

  • Gravatar Kamal Nasser 11 months

    @mik.howard: Instead of copying ~/wordpress/* to /var/www, copy it to your virtual host's DocumentRoot (sudo cp -r ~/wordpress/* /var/www/).

  • Gravatar Adam Heward 11 months

    Could someone please include easy to follow instructions like the ones about for setting up WordPress' notification email system?

  • Gravatar Kamal Nasser 11 months

    @Adam Heward: You need to install an MTA so you can send mail from your droplet - I suggest postfix as it is easy to set up: apt-get install postfix Once you have installed it, mail should automatically work.

  • Gravatar m1st0 11 months

    WordPress automatic updates + FTP: Wow, all this time and messing with VSFTPD with no success. Thanks for the simple tip. I didn't need to mess with secure FTP at all. Unfortunately, that was never shown in the WordPress admin screen in one of my old installations, especially when you have multiple locations of WordPress installs for different development projects. This easily helps WordPress update without FTP servers: sudo chown -R www-data:[user_name] [location_of_WordPress]

  • Gravatar beardsleym 11 months

    If I want to install Wordpress into a sub directory such as 'wordpress' what steps do i need to change?

  • Gravatar Kamal Nasser 11 months

    @beardsleym take a look at this: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

  • Gravatar jacarve 11 months

    Hi, I follow your tutorial, all works really good, but when I change the permanlink into post name, the server didn't work, like 404 error :( I install apache and config like you guys said :), but i cannot fix that :( please help

  • Gravatar Kamal Nasser 11 months

    @jacarve run "cp -r ~/wordpress/.* /var/www" - does that fix it? I've also updated the article so you don't have to do this anymore.

  • Gravatar andrew 10 months

    Hey @Kamal, since you changed the article to "cp -r ~/wordpress/.* /var/www" can you please help me understand how to give WordPress the write permissions it will need to upload media files etc. Thanks.

  • Gravatar Kamal Nasser 10 months

    @andrew: Replied here - https://www.digitalocean.com/community/questions/wordpress-multisite-is-unable-to-upload-media-files-because-it-does-not-have-the-necessary-permissions Please don't duplicate your questions.

  • Gravatar jimingkui 10 months

    Nice tutorial!! Just one problem, what's the "username" in step 4. I installed LNMP, so it should be Nignx user, but how to tell my nignx user name? "Give ownership of the directory to the apache user. sudo usermod -a -G www-data username " Much thanks!

  • Gravatar Kamal Nasser 10 months

    @jimingkui nginx runs as www-data as well so the command would be the same.

  • Gravatar John Love 9 months

    Thanks for the guide but I'm running into an issue. When attempting to set the password for my new user with "SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password"); " my shell returns "">" instead of "Query OK, 0 rows affected (0.00 sec)". Not sure what to do.

  • Gravatar John Love 9 months

    Never mind. I just realized I made a typo and fixed it. Wish I could edit or delete the previous comment.

  • Gravatar aat.rutten 9 months

    Im migrating a wordpress install from another VPS to my droplet and putting it in a directory /var/www/myblog and then with apache virtual hosts pointing a subdomain like myblog.mydomain.com to the document root /var/www/myblog but for some reason I cant get wordpress to connect to the DB. I keep getting the "Error establishing a database connection" wordpress page. I know the DB (root) credentials in wp-config are correct because I can connect to mysql via the command line. If i change the DB_HOST from localhost to ip-address I get different error messages but both messages say that I cant connect to the DB. 1 message is just a simple PHP output while the other is a nicely formatted Wordpress HTML page. I am running Ubuntu 12.04, PHP 5.3.10, MySQL 5.5.31, and Wordpress 3.3.2. Any ideas what I might be doing wrong?

  • Gravatar Kamal Nasser 9 months

    @aat.rutten: Try creating a user for wordpress instead of using the root credentials - See "Step Two—Create the WordPress Database and User:

  • Gravatar raja.ramanathan 9 months

    Took just <10 mins from start to finish. Never had such a smooth LAMP install before and all kudos goes to your article. Another happy customer. Keep up the good work!!!

  • Gravatar Matt Miller 9 months

    It would be good idea to remind people doing the installs to also set the Authentication Unique Key and Salts at the same time they set up the database configuration in the wp-config.php file.

  • Gravatar Leo 9 months

    Just got "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." Error. Tell me how I can fix it. Thanks!

  • Gravatar Kamal Nasser 9 months

    @Leo: Run "sudo apt-get install php5-mysql".

  • Gravatar Leo 9 months

    @Kamal, great, thanks

  • Gravatar jcp.christopher 9 months

    Thanks it was perfect tutorial!

  • Gravatar Jbouska419 9 months

    GREAT TUTORIAL!!!! I went through the tutorial and changed my dir.conf file, but when I go to view my site it is still only showing the IT WORKS!!! screen. I cannot view my page. Any suggestions?

  • Gravatar Jbouska419 9 months

    Please disregard my previous post. I got it all figured out. GREAT WORK EVERYONE!!! THANK YOU!!!

  • Gravatar Dzulhelmi Jumat 9 months

    The moment when you change permission sudo chown www-data:www-data * -R Yes, you can update the plugins via wordpress admin, but now the problem is i cannot create new folder, upload files via SFTP? Is there any way where i can upload files/create folder via SFTP and also update plugins via Wordpress admin?

  • Gravatar Kamal Nasser 9 months

    @Dzulhelmi: You shouldn't chown everything to www-data:www-data. You should chown youruser:www-data and chmod 775 the directories you want to be able to write to.

  • Gravatar postcreative 9 months

    @Kamal you wrote "@mik.howard: Instead of copying ~/wordpress/* to /var/www, copy it to your virtual host's DocumentRoot (sudo cp -r ~/wordpress/* /var/www/)." I don't understand the command for installing wordpress on a virtual host - which part of this line contains the virtual hosts name do I replace the * or does the virtual host name come after the www/? sudo cp -r ~/wordpress/* /var/www/

  • Gravatar Dzulhelmi Jumat 9 months

    @Kamal, then the tutorial should be update, including the chmod 775 the directories we want to be able to write to

  • Gravatar Kamal Nasser 9 months

    @postcreative: You would set up the virtual host as usual and have the wordpress files copied to its DocumentRoot: https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts

  • Gravatar Kamal Nasser 9 months

    @Dzulhelmi: Sorry, in this case it would be okay for wordpress to be able to write to the /var/www directory since that is how it does its updates/installs themes/etc.

  • Gravatar felix.johnson 8 months

    Hello, how do I get my site index to work when wordpress index is there in the root dir. I tried to move it there but I couldn`t. Any idea what I should do?

  • Gravatar Kamal Nasser 8 months

    @felix.johnson: "I tried to move it there but I couldn`t." - How did you try to move them? What's the output of this command?

    ls /var/www

  • Gravatar felix.johnson 8 months

    using winscp

  • Gravatar felix.johnson 8 months

    I got alot of informations about WP

  • Gravatar felix.johnson 8 months

    Hi James tansley, can u guide me on how I can uninstall Wordpress from my vps. Like u said above, it`s true that the folder should be changed when installing wordpress. I read ur post after I have installed it and I installed it in /www/ folder. Now I want to remove it and re-install it on Another folder. Can u help me with the command? thnx

  • Gravatar Kamal Nasser 8 months

    @felix.johnson: What's the output of this command?

    ls /var/www
    Connect using SSH, run that command, and paste the output.

  • Gravatar paediatech 8 months

    I installed wordpress on a domain in the virtual host and everything seem to be working fine so far. The only problem I have presently is the .htaccess file for the specific wordpress installation. How do i create and edit the .htaccess file for that installation and make it writable. Regards

  • Gravatar Kamal Nasser 8 months

    @paediatech: The .htaccess file can be found in /var/www/.htaccess

  • Gravatar hughdshields 8 months

    Is there a preferred process for installing Wordpress on DigitalOcean? I see a lot of the same file permission problems and permalink issues on comment streams for both the One-click install and Installing Wordpress on Ubuntu 12.04. Please advise on which has the least issues.

  • Gravatar Kamal Nasser 8 months

    @hughdshields: I recommend starting off with the one-click wordpress install. Enabling permalinks is really easy, take a look at my comment on the one-click wordpress install article: Posted August 17th, 2013 07:47 https://www.digitalocean.com/community/articles/one-click-install-wordpress-on-ubuntu-12-10-with-digitalocean

  • Gravatar alex 8 months

    Etel Sverdlov, nice to meet you, we are relatives!

  • Gravatar François 7 months

    Thanks all for advices and great tutorial :)

  • Gravatar maarten 7 months

    Noob question? Sorry if this is dumb but concerning the below; Give ownership of the directory to the apache user. sudo chown www-data:www-data * -R sudo usermod -a -G www-data ?username? What do i use for ?username? Would anybody help me out with this i was guessing but got nowhere. Many thx in advance!

  • Gravatar Kamal Nasser 7 months

    @maarten: Replace 'username' with the user you log in as (non-root).

  • Gravatar maarten 7 months

    THX! @ Kamal Nasser (it was one of my noob guesses but needed to be sure..)

  • Gravatar Elimedia 7 months

    Excelent! this was my first tutorial followed here on D.O. and everything was fine. I have my WP installed and running. Great job. Thanks

  • Gravatar ethan 7 months

    Hello! I decided to go the route of installing Wordpress with the Wordpress Applications button, onto Ubuntu 12.10. I'm not having any issues with that whatsoever, other than where it's being served up from. I'd like to put the files in either `/var/www` or `/home/public_html` - but right now it's in `/home/wordpress/public_html` Can you walk me through how I change which folder is "web root"? THANKS!

  • Gravatar Kamal Nasser 7 months

    @ethan: It's not recommended to do that as you might run into permissions issues. Out of curiosity, why do you want to do that?

  • Gravatar apprei9 7 months

    Great Tutorial, Thanks. If you are going to install the set of 8 secret keys in WP, you might consider doing it post install. I missed something in the keys and ended up re-installing WP. There's a lot of text etc. that's easy to screw up.

  • Gravatar k2marketing.steve 6 months

    sudo chown www-data:www-data * -R /var/www/[website directory] has been suggested to fix some problems e.g. can't upload from admin or add plugins/themes - but what does this do from a security standpoint, yes it fixes the problem but does the solution create additional risk of any sort?

  • Gravatar cedulestarragones 6 months

    i did the Initial Server Setup, Ubuntu LAMP tutorial and wordpress install steps exactly like the models and when i click the dif pages on my website it appears the message: Not Found The requested URL /extension was not found on this server. Apache/2.2.22 (Ubuntu) Server at 82.196.5.88 Port 80 thanks

  • Gravatar Kamal Nasser 6 months

    @k2marketing.steve: It enables the webserver to write to (and delete) any file in the /var/www/[website directory] directory. @cedulestarragones: Is the mod_rewrite module enabled? See Michael's permalinks solution above.

  • Gravatar mattbaker+digitalocean 6 months

    This is brilliant... this with your LAMP / Ubuntu post... can't believe how easy this was... MANY THANKS!

  • Gravatar Jorge Gutierrez 5 months

    The InnoDB memory heap is disabled. In ubuntu 12.04 with Ram=512

  • Gravatar ultimaterinks2006 5 months

    Hi I followed the tutorial and i am able to access http://localhost/wp-admin/ successfully but when i tried to reach http://localhost/ it is still showing me "it works" page. I have already edited apache dir.conf file as suggested by @James Tansley. Not sure how to fix it ? Any suggestions ?

  • Gravatar Kamal Nasser 5 months

    @ultimaterinks2006: Try deleting the index.html file in /var/www:

    rm /var/www/index.html

  • Gravatar nickwillever 5 months

    I would suggest to do this after the user setup, just for security purposes. > ~/.mysql_history

  • Gravatar irfantony 4 months

    Hi, I'm up to Step Three—Setup the WordPress Configuration but can't move forward I use command (exactly the same): cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php And return: cp: cannot stat `/home/promoter/wordpress/wp-config-sample.php': No such file or directory (promoter is my username) Please help Thanks

  • Gravatar mrgusmuller 4 months

    tnks @cosmin !!! it worked! ;)

  • Gravatar Kamal Nasser 4 months

    @irfantony: What's the output of

    ls -1 /home/promoter/wordpress | grep config
    ?

  • Gravatar irfantony 4 months

    Hi Kamal, command: ls -1 /home/promoter/wordpress | grep config output: wp-config.php wp-config-sample.php It seems successfully make a copy file Btw, what "cannot stat" mean?

  • Gravatar postatender 4 months

    Hi guys. Need help here or I'll jump out the window. Just one question (I'm not going to be brief once that way I can provide more info and narrow choices: History: installed Ubuntu+WP image, tried to upload theme, oink; had to do it through FTP, tried to install plugin WP CSV, oink, had to create the wpcsv/uploads folder through FTP, tried to import a csv file, oink, blank page. So, went to WP CSV website, and apparently that's a common error related to WP folders permissions. So, I deleted old droplet, created new one with UBUNTU, with no apps, gone through this tutorial, and here I am, the WP site is successfully installed with my DNS on masking the ip. Cool. Problems: 1 - I try to install my 14 Mb theme and error message comes up gently asking me "Are you sure you want to do this? Please try again" I try again and the same question pops up. Searched the web and apparently that is a max_upload_size + ,ax_input_time + mas_post_size + max_execution time problem in php.ini file which I already changed to higher values. Restarted apache and voilá... same problem. So, either there is more than one php.ini file and I edited the wrong one (i edited the one located in etc/php5/apache2/php.ini; or there is some kind of problem unzipping .zip files (I don't know, I'm an amateur) once I'm using ubuntu or something wrong with permissions. HELP PLEASE?!

  • Gravatar postatender 4 months

    oh, and I already edited the upload_max_filesize as well

  • Gravatar Kamal Nasser 4 months

    @irfantony: It means that the file does not exist. Did you manage to fix it?

  • Gravatar Kamal Nasser 4 months

    @postatender: Please don't jump out the window. :] Did you restart apache?

  • Gravatar chriscooper456 4 months

    Hi, followed the instructions on here and got Wordpress installed. However whenever I publish a post my site goes down and I'm left with an Error Establishing Database Connection message. I can get rid of it by typing 'sudo server mysql restart' in putty, but having to do this after every post is getting rather tedious. Has anybody encountered this before, or know of a way in which I can fix? Cheers

  • Gravatar Kamal Nasser 4 months

    @chriscooper456: Try adding swap to your droplet: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04.

  • Gravatar persiu20 3 months

    root@debian:/home/persu# sudo rsync -avP ~/wordpress/ /var/www/ sudo: rsync: command not found Is anything wrong in my command ?

  • Gravatar Kamal Nasser 3 months

    @persiu20: Try installing rsync, sudo apt-get install rsync.

  • Gravatar persiu20 3 months

    OK all is runing. Dou yo have any idea about web server performance testing(NGINX,apache, IIS) ? How to generate traffic from console and what sql queries to make servers slowly? Or other idea?

  • Gravatar persiu20 3 months

    Last Question. If I installed wordpress on apache , so i dont have to install wordpress second time for nginx? Then i stop apache and run it on Nginx?

  • Gravatar david 3 months

    Awesome tutorial... after making changed suggested from James Tansley above, everything is working perfectly... thanks again, great job!!

  • Gravatar Notbiz 3 months

    I followed these directions. However, when I got to the second last step where I executed the 'sudo chown www-data:www-data * -R' command I had forgotten to first switch to the /var/www directory. I therefore executed it from the root directory. It took some time to execute and gave me a few pages of lines saying operation not permitted on a number of directories/files. I then changed to the /var/www directory and executed it again only to get a message staying 'sudo: /user/lib/sudo/sudoers.so must be owned by uniden 0'. Have I messed things up??

  • Gravatar Kamal Nasser 3 months

    @Notbiz: Sadly, yes :(. I would set up a new droplet and transfer the files over.

  • Gravatar Notbiz 3 months

    Towards the end of the directions above one is supposed to execute the following: Sudo user mod -a -G www-data username My question is - what is the username?

  • Gravatar Kamal Nasser 3 months

    @Notbiz: It's the username that you usually use to connect to your droplet/transfer files. If you use root for everything, I suggest checking out https://www.digitalocean.com/community/articles/initial-server-setup-with-ubuntu-12-04 and creating a user.

  • Gravatar Anna Kyst 3 months

    Install Postfix for outbound mail [Contact7 form] Re: apt-get install postfix I did this on WP on Ub 12.1 and chose 'No Changes' on the final config. question. Tried to send email but, got this message: Failed to send your message. Please try later or contact the administrator by another method any help gratefully received. Thank you.

  • Gravatar Kamal Nasser 3 months

    @annak:

    Tried to send email but, got this message:
    How did you try to send the email? Did you use a plugin? Try configuring it to use the mail() php function.

  • Gravatar Austen Blokker 3 months

    The chmod command doesn't work for me, it's not actually changing the group permission of the www directory sudo chown www-data:www-data * -R However this command worked for me when I run it from the var directory sudo chown :www-data www Now I can finally upload to my server!

  • Gravatar Notbiz 2 months

    I am almost done. Got wordpress installed to the server. Then did the initial wordpress setup - where it asks for your site name etc. made it to the wordpress 'dashboard' where you work on your page etc. just a little confused here. It shows I have a theme etc. and it suggests things like adding an about page. However, when I click on the 'view page' I just get the default web page from my server (the one that says 'It Works'). So I am a little confused (and probably somewhat stupid). Did it not create me a basic page withe the site name I provided and with the theme. Did I forget to do something.

  • Gravatar Notbiz 2 months

    Sorry, I got it fixed. I should have read the very first comment to the article. It had the key. Thanks. Although when I restarted apache as noted there I did get the message "could not reliably determine the servers fully qualified domain name, using 127.0.1.1 for servername. If anyone has an idea about this one I would appreciate comment. But I am now able to see my web page from the wordpress dashboard!

  • Gravatar lucasmx 2 months

    Omg my LEMP server was totally ok but after i gave the comand chown www-data:www-data * -R my mysql server crashed and it wont load anymore... Digital Ocean has great tutorials but many of them are missing some steps

  • Gravatar Kamal Nasser 2 months

    @lucasmx: It seems like you ran that command in / and broke the permissions of several important files. I would recommend starting over on a new droplet in this case. I've also updated the article with a better command.

  • Gravatar rvreugdenhil about 1 month

    Hey Kamal, I have installed everything properly. But editing and adding the index.php from my site folder to the root doesnt leave me with a nice url structure my site is now in a folder as followed: /var/www/mysiteurl/public_html/mywordpressinstall/ --> it shows on mysiteurl correct. Could you direct me to a tutorial or something on setting up public_html outside tthe www folder? thanks

  • Gravatar rvreugdenhil about 1 month

    I'd like to add that i want to hide everything after /mysiteurl/ --> i want to see it like this: public_html/mywordpressinstall_folder

  • Gravatar shivam.s.sharma about 1 month

    I'm getting this error in step 4(Give ownership of the directory to the apache user) Error message: sudo:unable to resolve host www.bagztra.com how can i resolve this? thanks

  • Gravatar william.lam1 about 1 month

    Hey there, I'm faced with the error: Can't select database We were able to connect to the database server (which means your username and password is okay) but not able to select the quantifire database. Are you sure it exists? Does the user quantifire have permission to use the quantifire database? On some systems the name of your database is prefixed with your username, so it would be like username_quantifire. Could that be the problem? Tried several combinations in terms of configuring the wp-config file but to no avail... :(

  • Gravatar Kamal Nasser about 1 month

    @william.lam1: Does the user you're connecting as have permission to access the quantifire database? Can you access it if you log in as root?

  • Gravatar scott about 1 month

    Whenever I upload a file using my root credentials over an ssh connection, wordpress can't overwrite those files from the admin until I run 'sudo chown www-data:www-data * -R' So my question is, is there a way to add my root user to the www-data group so I don't have to run that every time, or am I better off creating an ssh account for the wordpress user? Thanks a bunch.

  • Gravatar Kamal Nasser about 1 month

    @scott: You shouldn't log in as root unless you need to. Create a new user (https://www.digitalocean.com/community/articles/initial-server-setup-with-ubuntu-12-04) and run the following command:

    sudo chown -R youruser:youruser /var/www
    sudo chmod g+w /var/www
    sudo usermod -a -G youruser www-data
    That should fix it.

  • Gravatar william.lam1 about 1 month

    Hey Kamal, Yes I can - I was just following along the instructions that you created...

  • Gravatar Kamal Nasser about 1 month

    @william.lam1: What's the output of

    grep -ri 'define' /path/to/wp-config.php
    ? Don't forget to mask out any sensitive data before posting.

  • Gravatar alexandrepjh about 1 month

    Hello, this tutorial also works for prestashop?

  • Gravatar aknath.707 about 1 month

    Here is a step by step tutorial: http://wp.me/p3Po0l-hq

Leave a Comment

Create an account or login:
Ajax-loader