Diferència entre revisions de la pàgina «CMS backup and restoring»
(→More) |
|||
(Hi ha 2 revisions intermèdies del mateix usuari que no es mostren) | |||
Línia 5: | Línia 5: | ||
− | === | + | == Backup (export) existing CMS == |
+ | To export your original CMS you need to: | ||
# Backup files in the source CMS (with tar, zip, etc.). | # Backup files in the source CMS (with tar, zip, etc.). | ||
− | #: Our suggestion is to use the command: <pre>$ tar cvfz cmsfoldername.tar.gz | + | #: Our suggestion is to use the command: <pre>$ tar cvfz cmsfoldername.tar.gz <cms_folder_name></pre> (obviously changing ''<cms_folder_name>'' for your CMS folder name). |
# Export database with mysqldump (in a *.sql file). We can use: | # Export database with mysqldump (in a *.sql file). We can use: | ||
− | #* Command mysqldump. With:<pre>$ mysqldump -u | + | #* Command mysqldump. With:<pre>$ mysqldump -u <username> -p cmsdbname > cmsdb.sql</pre>We will create the file cmsdb.sql with all CMS DB data. Obsioulsy you have to change ''<username>'' for your user name. |
#* phpmyadmin: too easy to give explanations for that. | #* phpmyadmin: too easy to give explanations for that. | ||
That should result in having 2 files, (1) *.tar.gz and (2) *.sql. | That should result in having 2 files, (1) *.tar.gz and (2) *.sql. | ||
− | === | + | == Restore (import) the backuped CMS == |
+ | To import the backuped CMS in the new system you need to: | ||
We need 2 files: the tarball and the sql for database. | We need 2 files: the tarball and the sql for database. | ||
# Copy the files (*.sql and *.tar.gz) to your target system. | # Copy the files (*.sql and *.tar.gz) to your target system. | ||
Línia 20: | Línia 22: | ||
#* Using the tar command is (you need SSH access to your system)<pre>$ tar xvfz cmsfoldername.tar.gz</pre> | #* Using the tar command is (you need SSH access to your system)<pre>$ tar xvfz cmsfoldername.tar.gz</pre> | ||
#* If your system doesn't have SSH you can uncompress the files in your local machine and upload it using FTP. | #* If your system doesn't have SSH you can uncompress the files in your local machine and upload it using FTP. | ||
− | # Change the folder name if you need it.<pre>$ mv cmsfoldername newfoldername</pre> | + | # Change the folder name if you need it.<pre>$ mv <cmsfoldername> <newfoldername></pre> |
# Create the database in the target system. | # Create the database in the target system. | ||
− | #* Using ''mysqladmin'' command:<pre>$ mysqladmin -u | + | #* Using ''mysqladmin'' command:<pre>$ mysqladmin -u <username> -p create <username>_newdb</pre>(Obviously changing ''<username>'' for your user name and ''newdb'' for something related to your CMS as "wp1" or "wiki2"). |
− | #* Using ''mysql'' command:<pre>$ mysql -u | + | #* Using ''mysql'' command:<pre>$ mysql -u <username> -p</pre> |
− | #: <pre>mysql> create database | + | #: <pre>mysql> create database <username>_newdb;</pre> |
#* Using phpmyadmin | #* Using phpmyadmin | ||
# Import the SQL file in the new database. | # Import the SQL file in the new database. | ||
− | #* Using ''mysql'' command:<pre>$ mysql -u | + | #* Using ''mysql'' command:<pre>$ mysql -u <username> -p <username>_newdb < cmsdb.sql</pre> |
#* Using phpmyadmin | #* Using phpmyadmin | ||
Línia 35: | Línia 37: | ||
* Mediawiki: LocalSettings.php | * Mediawiki: LocalSettings.php | ||
* Joomla!: configuration.php | * Joomla!: configuration.php | ||
+ | |||
You have to review this settings to make the CMS work again: | You have to review this settings to make the CMS work again: | ||
Línia 41: | Línia 44: | ||
* DB password | * DB password | ||
* root folder of the installation | * root folder of the installation | ||
+ | |||
+ | |||
+ | In '''Wordpress''' you also have to change the SITE DIRECTORY that is not in the wp-config.php file but in the DATABASE. If you don't change it, the images will not appear and some functionalities may not work. | ||
+ | |||
+ | The easy way as indicated [http://codex.wordpress.org/Moving_WordPress here]: | ||
+ | * Go to admin -> Settings -> General | ||
+ | * Change Wordpress Address (URI) and Site Address (URL) | ||
+ | * Save changes and go! | ||
+ | |||
+ | The taugh way (may be not enough, that's only for the URI): | ||
+ | * Go to PHPMYADMIN and select the WP database | ||
+ | * Go to the table WP_OPTIONS | ||
+ | * Search "siteurl" in the ''option_name'' column. | ||
+ | * Edit (pen icon) this row and change "option_value" column to your new site name. | ||
== More == | == More == |
Revisió de 15:48, 7 maig 2014
To backup and restore a CMS we have to follow the following procedure:
- Export database and filesystem of the original CMS.
- Import files and database in the new system.
- Adjust the config files of the CMS to make it work.
Contingut
Backup (export) existing CMS[modifica]
To export your original CMS you need to:
- Backup files in the source CMS (with tar, zip, etc.).
- Our suggestion is to use the command:
$ tar cvfz cmsfoldername.tar.gz <cms_folder_name>
(obviously changing <cms_folder_name> for your CMS folder name).
- Our suggestion is to use the command:
- Export database with mysqldump (in a *.sql file). We can use:
- Command mysqldump. With:
$ mysqldump -u <username> -p cmsdbname > cmsdb.sql
We will create the file cmsdb.sql with all CMS DB data. Obsioulsy you have to change <username> for your user name. - phpmyadmin: too easy to give explanations for that.
- Command mysqldump. With:
That should result in having 2 files, (1) *.tar.gz and (2) *.sql.
Restore (import) the backuped CMS[modifica]
To import the backuped CMS in the new system you need to: We need 2 files: the tarball and the sql for database.
- Copy the files (*.sql and *.tar.gz) to your target system.
- Extract files in the target system.
- Using the tar command is (you need SSH access to your system)
$ tar xvfz cmsfoldername.tar.gz
- If your system doesn't have SSH you can uncompress the files in your local machine and upload it using FTP.
- Using the tar command is (you need SSH access to your system)
- Change the folder name if you need it.
$ mv <cmsfoldername> <newfoldername>
- Create the database in the target system.
- Using mysqladmin command:
$ mysqladmin -u <username> -p create <username>_newdb
(Obviously changing <username> for your user name and newdb for something related to your CMS as "wp1" or "wiki2"). - Using mysql command:
$ mysql -u <username> -p
mysql> create database <username>_newdb;
- Using phpmyadmin
- Using mysqladmin command:
- Import the SQL file in the new database.
- Using mysql command:
$ mysql -u <username> -p <username>_newdb < cmsdb.sql
- Using phpmyadmin
- Using mysql command:
Adjusting config files of the new CMS[modifica]
Each CMS needs to change different things. You have to look for the config file, depending on your CMS, for example:
- Wordpress: wp-config.php
- Mediawiki: LocalSettings.php
- Joomla!: configuration.php
You have to review this settings to make the CMS work again:
- DB name
- DB user
- DB password
- root folder of the installation
In Wordpress you also have to change the SITE DIRECTORY that is not in the wp-config.php file but in the DATABASE. If you don't change it, the images will not appear and some functionalities may not work.
The easy way as indicated here:
- Go to admin -> Settings -> General
- Change Wordpress Address (URI) and Site Address (URL)
- Save changes and go!
The taugh way (may be not enough, that's only for the URI):
- Go to PHPMYADMIN and select the WP database
- Go to the table WP_OPTIONS
- Search "siteurl" in the option_name column.
- Edit (pen icon) this row and change "option_value" column to your new site name.
More[modifica]
To know more you can read that articles for database creation, export and import:
- SQL exportacio: DB export.
- SQL creacio: creation and import of databases.
You can use several commands to synchronize your data in a remote server with your local filesystem:
- rsync is the most common used, but you need SSH access to your site.
- Some hostings just provide FTP service, so you can read this article for other ways to syncronize over FTP. Particularly you can use this ones:
- mirror
- wget: can work over FTP as well as HTTP
- sitecopy
- lftp (seems more complex needing a script)