Thursday, August 25, 2011
DirectAdmin use port 80
1. create a da.ns64.small-dns.net account first, enable SSL, use private_html
2. add /usr/local/directadmin/data/users/dans72/http.conf
SSLProxyEngine ON
ProxyRequests Off
ProxyPass / https://localhost:2222/
ProxyPassReverse / https://localhost:2222/
3. vi /usr/local/directadmin/conf/directadmin.conf
check_referer=0
4. restart apache
2. add /usr/local/directadmin/data/users/dans72/http.conf
SSLProxyEngine ON
ProxyRequests Off
ProxyPass / https://localhost:2222/
ProxyPassReverse / https://localhost:2222/
3. vi /usr/local/directadmin/conf/directadmin.conf
check_referer=0
4. restart apache
MYSQL
restor SQL
To check admin password:
cat /usr/local/directadmin/conf/mysql.conf
Restore mySQL:
mysql -u da_admin -p -v -D bryanlyt_wrdp2 < ./bryanlyt_wrdp2.sql
backup SQL
mysqldump -u user01 -p -Q --disable --extended-insert database01 > filename.sql
restore SQL
mysql -u username -p database_name < filename.sql
MySQL grant permission
1. login as da_admin
2. use mysql;
3. select super_priv from user where user='webmanfb_wfb'; (to check privilege)
3. update user set super_priv='y' WHERE user='webmanfb_wfb'; (grant privilege)
4. flush privileges;
To check admin password:
cat /usr/local/directadmin/conf/mysql.conf
Restore mySQL:
mysql -u da_admin -p -v -D bryanlyt_wrdp2 < ./bryanlyt_wrdp2.sql
backup SQL
mysqldump -u user01 -p -Q --disable --extended-insert database01 > filename.sql
restore SQL
mysql -u username -p database_name < filename.sql
MySQL grant permission
1. login as da_admin
2. use mysql;
3. select super_priv from user where user='webmanfb_wfb'; (to check privilege)
3. update user set super_priv='y' WHERE user='webmanfb_wfb'; (grant privilege)
4. flush privileges;
install php SOAP
mkdir /usr/local/directadmin/custombuild/custom
mkdir /usr/local/directadmin/custombuild/custom/ap2
cp /usr/local/directadmin/custombuild/configure/ap2/configure.php5 /usr/local/directadmin/custombuild/custom/ap2/configure.php5
Edit ./custom/ap2/configure.php5 and add --enable-soap to the file, using the same \ syntax as you see in the file. Save it, ./build php and it worked perfectly.
mkdir /usr/local/directadmin/custombuild/custom/ap2
cp /usr/local/directadmin/custombuild/configure/ap2/configure.php5 /usr/local/directadmin/custombuild/custom/ap2/configure.php5
Edit ./custom/ap2/configure.php5 and add --enable-soap to the file, using the same \ syntax as you see in the file. Save it, ./build php and it worked perfectly.
install 'i DBD::mysql
*** using perl
http://help.directadmin.com/item.php?id=49
This line should be good:
perl -MCPAN -e 'install Bundle::DBD::mysql'
***** from source
wget http://www.cpan.org/modules/by-module/DBD/DBI-1.608.tar.gz
tar xvzf DBI-1.608.tar.gz
cd DBI-1.608
unset LANG;
perl Makefile.PL
make
make install
cd ..
wget http://www.cpan.org/modules/by-module/DBD/DBD-mysql-3.0002.tar.gz
tar xvzf DBD-mysql-3.0002.tar.gz
cd DBD-mysql-3.0002
unset LANG;
perl Makefile.PL
make
make install
http://help.directadmin.com/item.php?id=49
This line should be good:
perl -MCPAN -e 'install Bundle::DBD::mysql'
***** from source
wget http://www.cpan.org/modules/by-module/DBD/DBI-1.608.tar.gz
tar xvzf DBI-1.608.tar.gz
cd DBI-1.608
unset LANG;
perl Makefile.PL
make
make install
cd ..
wget http://www.cpan.org/modules/by-module/DBD/DBD-mysql-3.0002.tar.gz
tar xvzf DBD-mysql-3.0002.tar.gz
cd DBD-mysql-3.0002
unset LANG;
perl Makefile.PL
make
make install
rsync example
nice -n10 rsync --verbose --group --owner --progress --stats --recursive --times --perms --links /home/eagroup/ /home2/eagroup
mv /home/eagroup /home/eagroup_bak
ln -s /home2/eagroup /home/eagroup
***********
TEST
1. eamil
2. web
3. FTP
If ok, rm -Rf /home/eagroup_bak
run at ns16
nice -n10 rsync --verbose --group --owner --progress --stats --recursive --times --perms --links --bwlimit=1024 --rsh="/usr/bin/ssh -l root -p 9321" -p 9321 /home/bernamatv/imap/bernama-tv.com root@210.5.45.153:/home/bernamatv/imap/bernama-tv.com/
mv /home/eagroup /home/eagroup_bak
ln -s /home2/eagroup /home/eagroup
***********
TEST
1. eamil
2. web
3. FTP
If ok, rm -Rf /home/eagroup_bak
run at ns16
nice -n10 rsync --verbose --group --owner --progress --stats --recursive --times --perms --links --bwlimit=1024 --rsh="/usr/bin/ssh -l root -p 9321" -p 9321 /home/bernamatv/imap/bernama-tv.com root@210.5.45.153:/home/bernamatv/imap/bernama-tv.com/
Install Varnish
ref: http://wiki.ip.my/?View=entry&EntryID=56
yum install varnish
copy conf fro ns22
vi /etc/sysconfig/default.vcl and modify the .host to the server's primary IP
/etc/sysconfig/varnish
yum install varnish
copy conf fro ns22
vi /etc/sysconfig/default.vcl and modify the .host to the server's primary IP
/etc/sysconfig/varnish
sync server time and date
yum install ntp
01 01 * * * /usr/bin/rdate -s ntp1.csx.cam.ac.uk && /sbin/hwclock --systohc --localtime >/dev/null 2>&1
01 01 * * * /usr/bin/rdate -s ntp1.csx.cam.ac.uk && /sbin/hwclock --systohc --localtime >/dev/null 2>&1
Install Ioncube
ref : http://www.webhostgear.com/77.html
1. download ioncube at http://www.ioncube.com/loaders.php
2. extract and put to /usr/local/ioncube
3. edit php.ini (/usr/local/lib/php.ini)
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.2.so
4. restart apache
5 to check: php -v
1. download ioncube at http://www.ioncube.com/loaders.php
2. extract and put to /usr/local/ioncube
3. edit php.ini (/usr/local/lib/php.ini)
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.2.so
4. restart apache
5 to check: php -v
Retrieve Plesk Email Password
Go remote server
cd %plesk_bin%
E:
dbclient.exe --direct-sql --sql="SELECT account_id AS 'ID', mail_name AS 'USERNAME', password AS 'PASSWORD', postbox as 'MAILBOX', name AS 'DOMAIN', redir_addr as REDIRECT FROM mail M, domains D, accounts A WHERE M.account_id = A.id AND M.dom_id = D.id AND D.name='[please change this only domain.com.my]';"
cd %plesk_bin%
E:
dbclient.exe --direct-sql --sql="SELECT account_id AS 'ID', mail_name AS 'USERNAME', password AS 'PASSWORD', postbox as 'MAILBOX', name AS 'DOMAIN', redir_addr as REDIRECT FROM mail M, domains D, accounts A WHERE M.account_id = A.id AND M.dom_id = D.id AND D.name='[please change this only domain.com.my]';"
Upgrade MYSQL version
Backup Entire Database
cat /usr/local/directadmin/conf/mysql.conf
use the username and password
mysqldump -u user01 -p --all-databases > all_databases_backup.sql
OR
Login directAdmin
Backup system file
Edit the following path's mysql version
/usr/local/directadmin/custombuild/options.conf
mysql=5.1 (version need upgrade)
mysql_inst=yes
mysql_backup=yes
cd /usr/local/directadmin/custombuild/
./biuld mysql
./build php n
check php
php -i
check mySQL
/etc/init.d/mysqld status
cat /usr/local/directadmin/conf/mysql.conf
use the username and password
mysqldump -u user01 -p --all-databases > all_databases_backup.sql
OR
Login directAdmin
Backup system file
Edit the following path's mysql version
/usr/local/directadmin/custombuild/options.conf
mysql=5.1 (version need upgrade)
mysql_inst=yes
mysql_backup=yes
cd /usr/local/directadmin/custombuild/
./biuld mysql
./build php n
check php
php -i
check mySQL
/etc/init.d/mysqld status
Smart Backup
ssh Remote sever Backup (without smart backup)
Go backup server 47.68
create a user use /sbin/useradd sglx2
add password use passwd sglx2 123123123
cd /home/sglx2/
mkdir .ssh
cd /.ssh
vi authorized_keys (new file), copy all the contain inside
check backup script how it run, then
check the file at /home/sglx2 (normallly is symbolic link), create the folder accordigly and link them.
after create folder, remember check the folder owner right.
-mkdir sglx2 (at data1, data2,data3 and data4)
-chown sglx2:sglx2 sglx2
-ln -s /data1/sglx2 /home/sglx2/backup1
go current server,
cd /root/.ssh
vi id_dsa.pub
(paste authorized_keys copy from backup server)
With smart backup
go backup server 47.68
vi ips1/createBackupRepo
cd /disks/sdaa1/
/ips1/createBackupRepo
vi /etc/rsyncd.secrets ( ket in password [a])
Go new server
cd /ips1
vi rsync.login (put in password [a])
fwup changes(folo ns56) *allow backup:
1. copy to new server
Copy smartbackup script to new server. test run, if backup server got file then success!
########################
Smart Backup ns56
#########################
#!/bin/bash
set -x
DEST_SERVER="210.5.47.68"
DEST_LOGIN="ns56"
DEST_FOLDER="ns56_backup"
TODAY=$(date +"%a")
NOW=$(date +"%d-%m-%Y")
i=$(date +"%Hh%Mm%Ss")
FILE="i.$NOW-$i.tar.gz"
zdate=$(date +"%F")
chmod 600 /ips1/rsync.login
#---------------------------------------------
# folder check
#---------------------------------------------
if [ ! -d "/ips1/tar.data" ]; then
mkdir /ips1/tar.data
fi
if [ ! -d "/ips1/tar.data/home" ]; then
mkdir /ips1/tar.data/home
fi
#---------------------------------------------
full_backup() {
#---------------------------------------------
case $TODAY in
Sun) DATA_PATH="backup_week";;
Mon) DATA_PATH="backup1";;
Tue) DATA_PATH="backup2";;
Wed) DATA_PATH="backup3";;
Thu) DATA_PATH="backup1";;
Fri) DATA_PATH="backup2";;
Sat) DATA_PATH="backup3";;
*) ;;
esac
#create coin file
date "+%F" > /home/zzdate.txt
date "+%F" > /root/zzdate.txt
date "+%F" > /etc/zzdate.txt
date "+%F" > /var/lib/mysql/zzdate.txt
date "+%F" > /var/named/zzdate.txt
date "+%F" > /usr/local/directadmin/zzdate.txt
date "+%F" > /var/www/html/webmail/zzdate.txt
# --------------------------------------
# backup home
# --------------------------------------
cd /home
for u in *; do
#rsync --password-file=/ips1/rsync.login -r --owner --group -v --progress --delete $u rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_FOLDER/$DATA_PATH/home/
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete --exclude *.tar.gz --exclude *.iso $u rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/home
done
# --------------------------------------
# backup etc
# --------------------------------------
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete /etc rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete /var/named rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete /usr/local/directadmin rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/directadmin
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete /var/spool/cron rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/cron
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete /var/lib/mysql rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/mysql
rsync --compress --password-file=/ips1/rsync.login -r --times --perms --links --owner --group -v --progress --delete /var/www/html/squirrelmail rsync://$DEST_LOGIN@$DEST_SERVER:/$DEST_LOGIN\_$DATA_PATH/
#monitor rsync_backup
/usr/bin/curl http://210.48.154.215/ips1/update_db.php?zzdate=$zdate\&zzhost=$DEST_LOGIN\&zzpath=$DATA_PATH
}
#---------------------------------------------
# MAIN()
#---------------------------------------------
full_backup
Subscribe to:
Posts (Atom)