$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
for Static
DEVICE=eth0
ONBOOT=yes
HWADDR=00:0c:29:c3:90:85
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
IPADDR=172.16.1.3
NETMASK=255.255.0.0
GATEWAY=172.16.10.1
for dhcp
DEVICE=eth0
ONBOOT=yes
HWADDR=00:0c:29:c3:90:85
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
BOOTPROTO=dhcp
Showing posts with label Host and Domain. Show all posts
Showing posts with label Host and Domain. Show all posts
May 2, 2008
Jul 8, 2007
VirtualHost in Apache Sample
Create two virtual host anh.biz.tm and mangmaytinh.biz.tm
Append to the end of file /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin onlyyoumakemesmile@gmail.com
DocumentRoot /var/www/html/anh.biz.tm/simpleviewer
ServerName anh.biz.tm
ErrorLog logs/anh.biz.tm-error_log
CustomLog logs/anh.biz.tm-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin onlyyoumakemesmile@gmail.com
DocumentRoot /var/www/html/mangmaytinh.biz.tm/wordpress
ServerName mangmaytinh.biz.tm
ErrorLog logs/mangmaytinh.biz.tm-error_log
CustomLog logs/mangmaytinh.biz.tm-access_log common
</VirtualHost >
Test syntax using
$ httpd -S
Append to the end of file /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin onlyyoumakemesmile@gmail.com
DocumentRoot /var/www/html/anh.biz.tm/simpleviewer
ServerName anh.biz.tm
ErrorLog logs/anh.biz.tm-error_log
CustomLog logs/anh.biz.tm-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin onlyyoumakemesmile@gmail.com
DocumentRoot /var/www/html/mangmaytinh.biz.tm/wordpress
ServerName mangmaytinh.biz.tm
ErrorLog logs/mangmaytinh.biz.tm-error_log
CustomLog logs/mangmaytinh.biz.tm-access_log common
</VirtualHost >
Test syntax using
$ httpd -S
Install and config MySQL
Installation
yum install mysql
yum install mysql-server
yum install mysql-administrator
Configuration
chkconfig --levels 235 mysqld on
Starting
/etc/init.d/mysqld start
Changing the root password
mysqladmin -u root password your_root_sql_password
Backup
One database
mysqldump --single-transaction nhungnguoibantot_db > backup_nhungnguoibantot_db.sql -p
All databases
mysqldump --single-transaction --all-databases > backup_all_databases.sql -p
Restore
One databases
mysql > create database nhungnguoibantot_db;
mysql -u root -p < backup_nhungnguoibantot_db.sql
All databases
mysql -u root -p < backup_all_databases.sql
Show all databases
mysql>show databases;
Connect to database
connect database_name;
Show all tables of a database
mysql>show tables;
Create a new user to manage database
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON database_name
TO 'username'@'localhost'
IDENTIFIED BY 'password';
yum install mysql
yum install mysql-server
yum install mysql-administrator
Configuration
chkconfig --levels 235 mysqld on
Starting
/etc/init.d/mysqld start
Changing the root password
mysqladmin -u root password your_root_sql_password
Backup
One database
mysqldump --single-transaction nhungnguoibantot_db > backup_nhungnguoibantot_db.sql -p
All databases
mysqldump --single-transaction --all-databases > backup_all_databases.sql -p
Restore
One databases
mysql > create database nhungnguoibantot_db;
mysql -u root -p < backup_nhungnguoibantot_db.sql
All databases
mysql -u root -p < backup_all_databases.sql
Show all databases
mysql>show databases;
Connect to database
connect database_name;
Show all tables of a database
mysql>show tables;
Create a new user to manage database
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON database_name
TO 'username'@'localhost'
IDENTIFIED BY 'password';
Configure PostgreSQL
To connect from other host than locahost
- In file postgresql.conf (/var/lib/pgsql/data/postgresql.conf)
Change or add
listen_addresses = "*"
- In file pg_hba.conf
Allow connect from localhost
host all all 192.168.1.0/24 trust
Allow connect from internet
host all all 0.0.0.0/0 trust
note
0.0.0.0/a mean that IP in a range of 0.0.0.0 with a bits is fixed
- In file postgresql.conf (/var/lib/pgsql/data/postgresql.conf)
Change or add
listen_addresses = "*"
- In file pg_hba.conf
Allow connect from localhost
host all all 192.168.1.0/24 trust
Allow connect from internet
host all all 0.0.0.0/0 trust
note
0.0.0.0/a mean that IP in a range of 0.0.0.0 with a bits is fixed
Installing inadyn as afraid.org Dynamic DNS client
Install by yum
# yum -y install inadyn.i386
Configure
# vi /etc/inadyn.conf
dyndns_system default@freedns.afraid.org
username userpublic
password passpublic
alias mangmaytinh.biz.tm,Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0
update_period 60000
log_file /var/log/inadyn.log
background
with "Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0" is hash(Direct URL http://freedns.afraid.org/dynamic/update.php?Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0) that you can get it from http://freedns.afraid.org/dynamic/ after you regist a subdomain
Configure start up daemon
# chkconfig --level 345 inadyn on
Start service
# service inadyn start
Check daemon run
# vi /var/log/inadyn.log
Debug
# inadyn --dyndns_system default@freedns.afraid.org -a mangmaytinh.biz.tm,Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0 -u userpublic -p passpublic --verbose 5
add --verbose 5 to see detail error
# yum -y install inadyn.i386
Configure
# vi /etc/inadyn.conf
dyndns_system default@freedns.afraid.org
username userpublic
password passpublic
alias mangmaytinh.biz.tm,Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0
update_period 60000
log_file /var/log/inadyn.log
background
with "Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0" is hash(Direct URL http://freedns.afraid.org/dynamic/update.php?Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0) that you can get it from http://freedns.afraid.org/dynamic/ after you regist a subdomain
Configure start up daemon
# chkconfig --level 345 inadyn on
Start service
# service inadyn start
Check daemon run
# vi /var/log/inadyn.log
Debug
# inadyn --dyndns_system default@freedns.afraid.org -a mangmaytinh.biz.tm,Um9ALVNVTVRTTUlBQUNzb21ZMDoyMTcwNTE0 -u userpublic -p passpublic --verbose 5
add --verbose 5 to see detail error
Subscribe to:
Posts (Atom)