Quantcast
Viewing latest article 8
Browse Latest Browse All 12

Backup and Transfer a LAMP(LAPP) System: Linux/Apache2/PostgreSQL/PHP

Assume we have an installed Linux system on hand. We have six parts to transfer: (1) User accounts; (2) User files (/home); (3) Database; (4) Apache; (5) PHP; and (6) crontab.

1. User accounts


Copy and transfer the following user-related files and directories:

./etc/passwd - File - contains various pieces of information for each user account ./etc/shadow - File - contains the encrypted password (and aging) information for user's accounts. ./etc/group - File - defines the groups to which users belong ./etc/gshadow - group shadow file (contains the encrypted password for group) ./var/spool/mail - Generally user emails are stored here. ./home - All Users data is stored here.
Do remember to "preserve (-p)" file info (permisions, owner, etc) in the transfer. Do not copy-and-paste the passwd/shadow files directly. It's recommended to only attach the human-added users into the new system user account files.

2. User Files (/home)



3. Database (PostgreSQL)


Backup (export):
Shell> pg_dumpall -U postgres | bzip2 > cluster_YYYYMMDD.bz2

Transfer (scp) and unzip (bzip2 -d) the database cluster file.

Restore (import):
Shell> psql -f cluster_YYYYMMDD -U postgres postgres

4. Apache


5. PHP



1. Install the modules:
php5-curl, php5-pgsql, php-openssl

2. Edit php.ini (/etc/php5/apache2/php.ini)

short_open_tag = On
output_handler = ob_gzhandler
upload_max_filesize = 8M
date.timezone = 'Asian/Taipei'

6. crontab



References:

http://www.cyberciti.biz/faq/howto-move-migrate-user-accounts-old-to-new-server/ (User accounts)
http://serverfault.com/questions/19274/how-to-transfer-user-accounts-to-a-new-linux-machine (User accounts)

Viewing latest article 8
Browse Latest Browse All 12