Quick look at the commands. Skip below to view the explanation of the commands
tar zxvf latest.tar.gz
vi wordpress/wp-config.php <-- Edit MySQL settings
mv -R wordpress/ /var/www/html/
steve@localhost ~: chrome incredigeek.com/
SSH into your webserver
Download the latest version of WordPress
cd ~/ && wget https://wordpress.org/latest.tar.gz
Extract the WordPress archive
tar zxvf latest.tar.gz
Create MySQL database and user
Refer to here if you want to do it from the command line. The recommended way is through your web control panel i.e. cPanel, Plesk, EHCP etc.
Enter in the DB information.
Move WordPress files to web directory
mv -R wordpress/* /path/to/webdir
If you want to install WordPress inside a sub directory on your website i.e. instead of going to “example.com” to access your WordPress site, you go to “example.com/wordpress”, then create a sub directory in your root web directory and move the WordPress files there.
Open up a browser and go to your website (example.com) to finish the WordPress installation.
You need to
- Upload WordPress Backup Files to server
- Restore WordPress Backup
- Restore Database Backup
If you need to backup your site then you can use this how to here
1. Upload WordPress Backup Files to server
Use your favorite ftp client(FileZilla?) to upload the MySQL database and WordPress files to the server. If they are already there skip to step 2.
In Linux you can use the ftp or sftp command.
once you connected you can upload your backups using put.
2. Restore the WordPress Files
This is super easy because all you have to do is untar the files. Make sure the file is in the directory that you want WordPress in.
tar -zxvf wp-backup.tgz
3. Restore Database Backup
If your MySQL backup is zipped, unzip it.
We need to create a database to import our backup. You can change wp_database to what ever you want.
mysql -u username -p
mysql> CREATE DATABASE wp_database;
mysql -u username -p wp_database < wp-database.sql
You should now have a fully functioning WordPress site.
There are 2 things we need to do when we backup a WordPress site.
- Backup the WordPress files
- Backup The WordPress database
Backup the WordPress files
We can backup the files with tar by running the following command. Replace (/Path/to/wpdir) with the actual path.
# tar -zcvf wp-backup.tgz /Path/to/wpdir/
This can take awhile depending on how big your site is.
Backup the Database
The following command will backup the WordPress database into a gziped sql file.
mysqldump -u username -p[root_password] database_name > wp-database.sql && gzip wp-database.sql
You can find the MySQL Database, username, and password in the wp-config.php file in the wordpress directory
You should now have two files, wp-backup.tgz and wp-database.sql.qz, you’ll need both of these to restore the backup.