1. install ladp component
#apt-get install ldap-utils
2. -H ldap server
-b bind
-D domain account
-w doamin password
#ldapsearch -LLL -H ldap://dc01.csp.com: 389 -b "dc=csp,dc=com" -D "cps\tommy" -w "abc123" "(sAMAccountName=tommy.lbs)"
2014年5月27日 星期二
2014年5月5日 星期一
install postfix and dovecot and redirect all mail to one account
1. install postfix, pcre and dovecot
# apt-get install postfix postfix-pcre
# apt-get install dovecot-core dovecot-imapd
2. confirm your dns mx record have one mx record for your mail server
3. modify your postfix configuration for your environment
# vim /etc/postfix/main.cf
myhostname = mail.csp.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, $mydomain, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.16.0.0/16
always_bcc = tommy@csp.com.tw
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/
#head_checks
header_checks = pcre:/etc/postfix/header_checks
4.add new file /etc/postfix/header_checks
5. check postfix setting and restart postfix
# postfix check
# /etc/init.d/postfix restart
6.modify /etc/dovecot/dovecot.conf
#vim /etc/dovecot/dovecot.conf
uncomment the lines
listen = *, ::
base_dir = /var/run/dovecot/
instance_name = dovecot
login_greeting = Dovecot ready.
7. change 10-auth.conf
#vim /etc/dovecot/conf.d/10-auth.conf
uncomment line and change the value
disable_plaintext_auth = no
8.change 10-master.conf
#vim /etc/dovecot/conf.d/10-master.conf
change contents within lines as below
service imap-login {
inet_listener imap {
port = 143
}
inet_listener imaps {
port = 993
ssl = yes
}
service lmtp {
unix_listener lmtp {
mode = 0666
}
# apt-get install postfix postfix-pcre
# apt-get install dovecot-core dovecot-imapd
2. confirm your dns mx record have one mx record for your mail server
3. modify your postfix configuration for your environment
# vim /etc/postfix/main.cf
myhostname = mail.csp.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, $mydomain, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.16.0.0/16
always_bcc = tommy@csp.com.tw
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/
#head_checks
header_checks = pcre:/etc/postfix/header_checks
4.add new file /etc/postfix/header_checks
# vim /etc/postfix/header_checks
/TO:*@*/ REDIRECT check01@csp.com
5. check postfix setting and restart postfix
# postfix check
# /etc/init.d/postfix restart
6.modify /etc/dovecot/dovecot.conf
#vim /etc/dovecot/dovecot.conf
uncomment the lines
listen = *, ::
base_dir = /var/run/dovecot/
instance_name = dovecot
login_greeting = Dovecot ready.
7. change 10-auth.conf
#vim /etc/dovecot/conf.d/10-auth.conf
uncomment line and change the value
disable_plaintext_auth = no
8.change 10-master.conf
#vim /etc/dovecot/conf.d/10-master.conf
change contents within lines as below
service imap-login {
inet_listener imap {
port = 143
}
inet_listener imaps {
port = 993
ssl = yes
}
service lmtp {
unix_listener lmtp {
mode = 0666
}
service auth {
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
}
auth_mechanisms = plain login
9. change 10-mail.conf
#vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
10.change 20-imap.conf
#vim /etc/dovecot/conf.d/20-imap.conf
imap_max_line_length = 64k
mail_max_userip_connections = 10
mail_plugins = $mail_plugins
imap_logout_format = bytes=%i/%o
imap_client_workarounds = tb-extra-mailbox-sep
11. restart the dovecot services.
# /etc/init.d/dovecot restart
2014年4月10日 星期四
ubuntu 12.04 install ntp server over http
1.install ntp server package
#apt-get update
#apt-get upgrade
#apt-get install ntp
2. modify ntp configuration
#vim /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 127.127.1.0
restrict csp.garmin.com notrap nomodify nopeer noquery
restrict 192.168.200.0 mask 255.255.255.0
restrict 127.0.0.1
broadcast 192.168.200.255
disable auth
broadcastclient
#apt-get update
#apt-get upgrade
#apt-get install ntp
2. modify ntp configuration
#vim /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 127.127.1.0
restrict csp.garmin.com notrap nomodify nopeer noquery
restrict 192.168.200.0 mask 255.255.255.0
restrict 127.0.0.1
broadcast 192.168.200.255
disable auth
broadcastclient
3. restart ntp serivce
#/etc/init.d/ntp restart
4.add third party component to source.list
#vim /etc/apt/source.list
deb http://ppa.launchpad.net/landronimirc/htpdate/ubuntu precise main
deb-src http://ppa.launchpad.net/landronimirc/htpdate/ubuntu precise main
5.add ppa key
#app-apt-repository ppa:landronimirc/htpdate
6.update repository
#apt-get update
7. install htpdate package
#apt-get install htpdate
8.setting crontab
#vim /etc/crontab
* */6 * * * /usr/bin/htpdate -d http://www.perl.org
9. restart cron job
#/etc/init.d/cron restart
2014年3月11日 星期二
Multipath with storage
1.install multipath tools
#apt-get install multipath-tools multipath-tools-boot
2. create multipath.conf
#cp /usr/share/doc/multipath-tools/examples/multipath.conf.synthetic /etc/multipath.conf
3.modify mutipath.conf
#vim /etc/multipath.conf
defaults {
path_grouping_policy multibus
failback immediate
no_path_retry fail
user_friendly_names yes
}
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z][[0-9]*]"
devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
}
#apt-get install multipath-tools multipath-tools-boot
2. create multipath.conf
#cp /usr/share/doc/multipath-tools/examples/multipath.conf.synthetic /etc/multipath.conf
3.modify mutipath.conf
#vim /etc/multipath.conf
defaults {
path_grouping_policy multibus
failback immediate
no_path_retry fail
user_friendly_names yes
}
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z][[0-9]*]"
devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
}
blacklist define device not included by multipath
4.restart multipath service
#service multipath-tools restart
5.show multipath status
#multipath -ll
mpath0 (360050cc000203d7a0000000000000008) dm-0 OVERLAND,RAID 1200
[size=1.5T][features=0][hwhandler=0]
\_ round-robin 0 [prio=2][active]
\_ 2:0:0:0 sda 8:0 [active][ready]
\_ 2:0:1:0 sdb 8:16 [active][ready]
6. if your disk is GPT format then install fixparts and install deb
#wget http://download.opensuse.org/repositories/home:/srs5694/xUbuntu_10.04/amd64/gptfdisk_0.8.8-1_amd64.de
#dpkg -i gptfdisk_0.8.8-1_amd64.deb
#apt-get -f install
7. format gpt disk
# fixparts /dev/mapper/mpath0
2014年2月19日 星期三
ubuntu 12.04 install php + mysql + apache2 + oracle + mssql develop environment
1. install all packages for os
# apt-get update
# apt-get upgrade
2. install compiler packages
# apt-get install buiild-essential fakeroot dpkg-dev
3. install apache, mysql server, php
# aptg-get install mysql-server mysql-client php5 php5-cli libapache2-mod-auth-mysql apache2
4. check php function
# vim /var/www/1.php
echo phpinfo();
?>
5. install mssql odbc module
# apt-get install php5-sybase
6. install oracle module
# apt-get install libaio1 php-pear unzip
7. download instantclient for oracle
# cd /usr/local/lib
# wget http://download.oracle.com/otn/linux/instantclient/121010/instantclient-basic-linux.x64-12.1.0.1.0.zip
# wget http://download.oracle.com/otn/llinux/instantclient/instantclient-sdk-linux.x64-12.1.0.1.0.zip
# unzip instantclient-basic-linux.x64-12.1.0.1.0.zip
# unzip instantclient-sdk-linux.x64-12.1.0.1.0.zip
# cd instantclient_12_1
# ln -s libclntsh.so.12.1 libclntsh.so
8. add some line to /etc/environment
# vim /etc/environment
# Oracle Instant Client
LD_LIBRARY_PATH="/usr/local/lib/instantclient_12_1"
TNS_ADMIN="/usr/local/lib/instantclient_12_1"
ORACLE_BASE="/usr/local/lib/instantclient_12_1"
ORACLE_HOME=$ORACLE_BASE
11. change apache default charset to utf-8
#vim /etc/apache2/conf.d/charset
uncomment AddDefaultCharset UTF-8
# apt-get update
# apt-get upgrade
2. install compiler packages
# apt-get install buiild-essential fakeroot dpkg-dev
3. install apache, mysql server, php
# aptg-get install mysql-server mysql-client php5 php5-cli libapache2-mod-auth-mysql apache2
4. check php function
# vim /var/www/1.php
echo phpinfo();
?>
5. install mssql odbc module
# apt-get install php5-sybase
6. install oracle module
# apt-get install libaio1 php-pear unzip
7. download instantclient for oracle
# cd /usr/local/lib
# wget http://download.oracle.com/otn/linux/instantclient/121010/instantclient-basic-linux.x64-12.1.0.1.0.zip
# wget http://download.oracle.com/otn/llinux/instantclient/instantclient-sdk-linux.x64-12.1.0.1.0.zip
# unzip instantclient-basic-linux.x64-12.1.0.1.0.zip
# unzip instantclient-sdk-linux.x64-12.1.0.1.0.zip
# cd instantclient_12_1
# ln -s libclntsh.so.12.1 libclntsh.so
8. add some line to /etc/environment
# vim /etc/environment
# Oracle Instant Client
LD_LIBRARY_PATH="/usr/local/lib/instantclient_12_1"
TNS_ADMIN="/usr/local/lib/instantclient_12_1"
ORACLE_BASE="/usr/local/lib/instantclient_12_1"
ORACLE_HOME=$ORACLE_BASE
9. install oci8 package for pear
# pecl install oci8
when you get the prompt for oracle_home, key in the path
'instantclient,/usr/local/lib/instantclient_12_1'
10. add extension to php.ini
# vim /etc/php5/apache2/php.ini
extension=oci8.so
11. change apache default charset to utf-8
#vim /etc/apache2/conf.d/charset
uncomment AddDefaultCharset UTF-8
12. restart apache
#/etc/init.d/apache2 restart
2014年2月11日 星期二
manual install mysql server
1. update and install some package need to install mysql
# apt-get update
# apt-get install fakeroot build-essential dpkg-dev libaio-dev
2. download mysql compress file from mysql site and decompress it
# tar zxvf mysql-advanced-5.5.28-linux2.6-x86_64.tar.gz
3. move it to /usr/local and create software link for mysql
# mv mysql-advanced-5.5.28 /usr/local/
# cd /usr/local
# ln -s mysql-advanced-5.5.28 mysql
4.create mysql user and group
# adduser -d /home/mysql -m mysql
5. change file owner and install mysql
# chown -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql
6.install mysql server
#/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql
7.copy mysql configure to /etc/
#cp suuport-files/my-medium.cnf /etc/my.cnf
8.start mysql server
#/usr/local/mysql/bin/mysql_safe --user=mysql &
9. add mysql search path to default environment
# vim /etc/environments
add /usr/local/mysql/bin to the end of the line
10. cp mysql script to /etc/init.d/
# cp support-file/mysql.server /etc/mysql.server
11. login mysql and change root password
#mysql -u root
grant all on *.* to 'root'@'localhost' identified by 'xxxxx'
flush privileges
12. restart mysql to confirm the password for rooot
# /etc/init.d/mysql.server restart
# apt-get update
# apt-get install fakeroot build-essential dpkg-dev libaio-dev
2. download mysql compress file from mysql site and decompress it
# tar zxvf mysql-advanced-5.5.28-linux2.6-x86_64.tar.gz
3. move it to /usr/local and create software link for mysql
# mv mysql-advanced-5.5.28 /usr/local/
# cd /usr/local
# ln -s mysql-advanced-5.5.28 mysql
4.create mysql user and group
# adduser -d /home/mysql -m mysql
5. change file owner and install mysql
# chown -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql
6.install mysql server
#/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql
7.copy mysql configure to /etc/
#cp suuport-files/my-medium.cnf /etc/my.cnf
8.start mysql server
#/usr/local/mysql/bin/mysql_safe --user=mysql &
9. add mysql search path to default environment
# vim /etc/environments
add /usr/local/mysql/bin to the end of the line
10. cp mysql script to /etc/init.d/
# cp support-file/mysql.server /etc/mysql.server
11. login mysql and change root password
#mysql -u root
grant all on *.* to 'root'@'localhost' identified by 'xxxxx'
flush privileges
12. restart mysql to confirm the password for rooot
# /etc/init.d/mysql.server restart
2013年12月10日 星期二
enable sftp transfer to instead of the ftp protocol
1. add these lines to /etc/ssh/sshd_config
Subsystem sftp internal-sftp
Match Group sftpusers
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
Subsystem sftp internal-sftp
Match Group sftpusers
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
2. add one group name sftpuser
#groupadd sftpusers
2. add one user for testing
useradd -g sftpusers -d /home/sftp/user1 -m user1
usermod -s /bin/false
3. add /bin/false to /etc/shells
4. change permission for the user
# chown root:root /home/sftp/user1
# chmod 755 /home/sftp/user1
5. restart the ssh service
# /etc/inti.d/ssh restart
6. create another folder to writable and mount it to the subfolder
# mkdir -p /home/sftp-write/user1
# mkdir /home/sftp/incoming
# mount --bind /home/sftp-write/user1/ /home/sftp/user/incoming
7. testing for the sftp
#sftp user1@xxxx.xxxx.xxxx.xxxx
訂閱:
文章 (Atom)