O/S Setting & Update

Command

VNC

VPN

MySQL

SSL HTTPS LetsEnLetsEncrypt

OwnCloud

NextCloud 12

Linux Editor

Trouble Sheeting

Clam AV

Postfix+dovecot+
Roundcube

Postfix +Dovecot +spamassassin +clamav +OpenWebMail

VM-pop3d Postfix+OpenWebMail

DNS

Sendmail

Dolphine

NetInstall

Virtuel Machine

hylafax

FeeBSD

System Update

YUM
FIREWALL iptable
NAT
DHCPD
ROUTER
SSHD
VISUDO
PHP
Apache
hosts
PhpMyAdmin
Proftpd
VsFtpd
Samba
NTP
Webmin
Upgrading to PHP5/MySQL5
Grub
Installing Linux on Software RAID 1
NFS
ChkRootKit


YUM

YUM update
$ yum -y install epel-release
$ yum -y install wget ntp unzip openssh-clients rsync net-tools lsof curl
$ chkconfig ntpd on
$ ntpdate pool.ntp.org //update the time:


$ yum install -y fuse fuse-ntfs-3g # ntfs windows partition

# exfat partition
$ rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
$ yum -y install exfat-utils fuse-exfat

$ yum install -y ibus-table-quick* ibus-table-cangjie ibus-table-sci
go to "System" --> "Reference" --> "Input Method" --> enable "input method" & select "Use Ibus .... " --> "input method Reference" --> select "Input Method" --> add method
check for latest version: RHEL6
64 bit
$ rpm -Uvh http://mirrors.servercentral.net/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -ivh http://fedora.mirrors.pair.com/epel/6/x86_64/Packages/e/epel-release-6-8.noarch.rpm

$ rpm -ivh http://fedora.mirrors.pair.com/epel/6/x86_64/Packages/e
/epel-release-latest-6.noarch.rpm
32 bit
$ rpm -Uvh http://mirrors.servercentral.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
$ rpm -ivh http://fedora.mirrors.pair.com/epel/6/i386/Packages/e/epel-release-6-8.noarch.rpm

****Error: Cannot retrieve metalink for repository: epel. Please verify its path.. https://blog.51cto.com/jschu/1750177
vim /etc/yum.repos.d/epel.repo , change to
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
$ yum clean all

$ yum -y update yum
$ yum -y update; reboot
**** To only use the DVDmedia repo , for Centos6 =c6-media ****
$ yum --disablerepo=\* --enablerepo=c6-media install pacakge-name
install FileZilla
$ yum --enablerepo=epel -y install filezilla

IPTABLE (FIREWALL)
vi /etc/sysconfig/iptables
##DROP any ping from outside
#-A OUTPUT -p icmp -i eth0 --icmp-type any -j ACCEPT
-A INPUT -p icmp -i eth0 --icmp-type any -j DROP
-A INPUT -p icmp -s 10.0.0.0 --icmp-type 24 -j ACCEPT
-A INPUT -p icmp -s 20.0.0.0 --icmp-type 24 -j ACCEPT
-A INPUT -p icmp -s 30.0.0.0 --icmp-type 24 -j ACCEPT
-A INPUT -p icmp -s 90.0.0.0 --icmp-type 24 -j ACCEPT
-A INPUT -p icmp -s 192.168.0.0 --icmp-type 24 -j ACCEPT
-A INPUT -p icmp -s 192.168.1.0 --icmp-type 24 -j ACCEPT
-A INPUT -p icmp -s 192.168.2.0 --icmp-type 24 -j ACCEPT

另外很多人會用到TCP SYN Flood 透過網路底層對服務器Server 進行攻擊的,我可以用 Iptables 防範下:, 防止同步包洪水(Sync Flood )
-A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT

-A INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT
--limit 1/s 限制syn 並發數每秒1 次,可以根據自己的需要修改.

防止各種端口掃描
-A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT

Ping 洪水攻擊(Ping of Death )
-A FORWARD -p icmp --icmp-type echo-r​​equest -m limit --limit 1/s -j ACCEPT
https://puremonkey2010.blogspot.hk/2014/02/linux-linux-synrecv.html

# Drop all network scanning
-A INPUT -p tcp --tcp-flags ALL ALL -j DROP
-A FORWARD -p tcp --tcp-flags ALL ALL -j DROP
-A INPUT -p tcp --tcp-flags ALL NONE -j DROP
-A FORWARD -p tcp --tcp-flags ALL NONE -j DROP
-A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
-A FORWARD -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
-A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
-A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j DROP

vi /etc/selinux/config
change SELINUX=disabled

NAT
/etc/sysconfig/network-script/ifcfg-eth0 , ifcfg-eth1 CentOS 6
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
HWADDR=00:50:fc:2b:38:16
IPV6INIT=no
PEERDNS=no # automatically obtain DNS from ISP provider
TYPE=Ethernet
;
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
#HWADDR=00:50:fc:3f:74:3ba
IPADDR=192.168.1.11
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=no
DNS1=202.130.101.13
DNS2=202.130.101.14
DNS3=202.130.97.65
DNS4=202.130.97.66
DOMAIN=dhcp.istarnet.net
WLAN0 wireless lan setting
YUM wireless tools and wpa_supplicant
$ yum -y install dhcp wireless-tools
$ yum -y install wpa_supplicant
check wireless device

$ iw dev

the output above show us a wireless network card identified as phy#0, but named wlan0

$ ip link show wlan0
the output see BROADCAST and MULTICAST you will have to use the ip command to turn on the interface with the following command: Recheck and make sure the interface is UP.
$ ip link set wlan0 up


show you have a lot of networks around you, the important fact here is that if you are seeing your network as well as others around, your wireless card is working properly.

$ iwlist wlan0 scanning

Configuring the wpa_supplicant service.
syntax: wpa_passphrase “SSID” “password”
$ wpa_passphrase <SSID> <password> >> /etc/wpa_supplicant/wpa_supplicant.conf

Open /etc/wpa_supplicant/wpa_supplicant.conf file with your favorite editor and make it look like the sample below:

network={
ssid=”SSIDname”
scan_ssid=1
key_mgmt=WPA-PSK
psk=210981238ab34c343234ccd2342342fac34234299999934f34f34fcbba34bbaaa
}

Next we need to modify the /etc/sysconfig/wpa_supplicant file. Specifically, the INTERFACES option and the DRIVERS option need to be set. Configure both to look like below:
INTERFACES=”-iwlan0”
DRIVERS=”-Dwext”
Save the file.

Create a network script file, ifcfg-wlan0. : vi /etc/sysconfig/network-scripts/ifcfg-wlan0

Example:

DEVICE=wlan0
HWADDR=00:1B:EE:AC:D0:D2
TYPE=Wireless
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.0.7
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
MODE=Managed
ESSID=”yourSSIDhere”
RATE=auto
SECURITYMODE=on
RTS=auto
FRAG=auto
WPA=yes

Save the file and run the following command:

$ wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
You should now be connected to your chosen Wifi network. To confirm this run the following command:

$ iw wlan0 link
Output
Not Connected
or
Connected to 00:23:4f:ee:ef:00 (on wlan0)
SSID: Examples
freq: 2412

………the rest of the output ommited

One important thing to note is what happens when you reboot. After reboot you will have to run two commands

$sudo wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
$sudo ifup wlan0
or
edit file /etc/rc.local , add above two commands

refer ULR
https://dworakowski1984.wordpress.com/2014/07/09/command-line-centos-6-to-wpawpa2-wireless-connection/
 


Mult IPs on one NIC in CentOS 6
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE=Ethernet
BOOTPROTO=none
IPADDR=125.214.194.225
NETMASK=255.255.255.248
#BROADCAST=192.168.1.255
GATEWAY=125.214.194.230
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
DNS1=203.198.23.208
DNS2=125.214.194.228
DNS3=125.214.194.229
DOMAIN=dhcp.wallaceko.com
HWADDR=40:61:86:93:91:75
PREFIX=29
/*Mult IPs setting */
IPADDR2=125.214.194.226
GATEWAY2=125.214.194.230
PREFIX2=29
IPADDR3=125.214.194.227
GATEWAY3=125.214.194.230
PREFIX3=29
IPADDR4=125.214.194.228
GATEWAY4=125.214.194.230
PREFIX4=29
IPADDR5=125.214.194.229
GATEWAY5=125.214.194.230
PREFIX5=29

# cd /etc/sysconfig/network-scripts/  /*** Multi IP on one NIC ***/
# cp ifcfg-eth0 ifcfg-eth0:0
# cp ifcfg-eth0 ifcfg-eth0:1
/*** eth0 config *** /
DEVICE="eth0"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR
=172.16.16.125
NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C
/*** eth0:0 config *** /
DEVICE="eth0:0"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=172.16.16.126

NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C
/*** eth0:1 config *** /
DEVICE="eth0:1"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=172.16.16.127

NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C



DHCPD
/etc/dhcpd.conf

authoritative;
default-lease-time 259200; #idle time
max-lease-time 518400; #max idle time
#option routers 192.168.3.1;
#option domain-name "xibase.net"; #refer resolv.conf - search name server
#option broadcast-address 192.168.3.255;
option domain-name-servers 203.83.112.1, 203.83.113.1, 203.83.111.19;
ddns-update-style none;

# eth0
subnet 202.130.101.2 netmask 255.255.255.255 {
range 202.130.101.2;
}

# eth1
#subnet 192.168.10.0 netmask 255.255.255.0 {
# authoritative;
# range 192.168.10.201 192.168.10.210;
# option routers 192.168.10.254;
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.168.10.255;
# host eth1 {
# fixed-address 192.168.10.254;
# }
# }

# eth2
subnet 192.168.20.0 netmask 255.255.255.0 {
authoritative;
range 192.168.20.101 192.168.20.200;
option routers 192.168.20.254;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.20.255;
# we want the nameserver to appear at a fixed address
host eth2 {
fixed-address 192.168.20.254;
}
}

# eth1
subnet 192.168.1.0 netmask 255.255.255.0 {
authoritative;
range 192.168.1.101 192.168.1.150;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
# we want the nameserver to appear at a fixed address
host eth1 {
fixed-address 192.168.1.1;
}
}

List DHCP client PC in LAN
cat /var/lib/dhcp/dhcpd.lease

ROUTER
/etc/rc.local

echo "1" > /proc/sys/net/ipv4/ip_forward
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.0/24 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.3.0/24 -d 0/0 -j MASQUERADE

/etc/sysconfig/iptables (firewall setting)
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 520 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 999 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 520 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 999 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT

###comment the below line###
#-A INPUT -j REJECT --reject-with icmp-host-prohibited
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited



SSHD
/etc/ssh/sshd_conf

Port=<port#> ;change port number
PermitRootLogin no ;not allow root login
AllowUsers <username> ;allow user login not root
/etc/rc.d/init.d/./sshd restart
chkconfig --level 35 sshd on
/etc/rc.d/init.d/./sshd start

Authorized Keys
Gen key in remote PC
#ssh-keygen -t rsa -b 4096 ; Gen keys
:) id_rsa and id_rsa.pub created and save <user_home path>/.ssh/ e.g. /home/jame/.ssh/,
:) rename id_rsa.pub to authorized_keys
:) transfer authorized_keys to SSH server

SSH server
copy authorized_keys to <user_home path>/.ssh/ e.g. /home/jame/.ssh/authorized_keys
edit sshd_config file #vim /etc/ssh/sshd.conf , change :

PubkeyAuthentication yes
PasswordAuthentication no
UsePAM no

restart sshd service


** stop telnet service
VISUDO
#cd /etc/
#visudo
/*** find User Aliases ***/ , add line
User_Alias ADMINS = <login_usen_name1> , <login_user_name2>, ....

/*** find Allow root to run any commands anywhere***/ , add line
ADMINS ALL=(ALL) NOPASSWD:ALL

/*** find Allows people in group wheel to run all commands***/ , add line
%ADMINS ALL=(ALL) NOPASSWD:ALL

PHP.INI

Upgrade PHP 5 to 7
/* verify the current PHP version installed: */
$ php -v
PHP 5.5.38 (cli) (built: Jul 21 2016 12:51:12) .....

$ yum list installed php* // display packages installed:
$ yum list available php* | grep php70 //Display available PHP 7 packages:

$ yum remove php* // remove all PHP 5.5 packages:

/*you need to add EPEL and Remi repository to your CentOS 6 system */
$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
or
$ yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm

$ yum install yum-utils // install yum-utils,

/* you need to enable Remi repository using yum-config-manager utility */
$ yum-config-manager --enable remi-php55
$ yum-config-manager --enable remi-php56
$ yum-config-manager --enable remi-php70
$ yum-config-manager --enable remi-php71
$ yum-config-manager --enable remi-php72

/* you need to disable Remi repository using yum-config-manager utility */
$ yum-config-manager --disable remi-php<version>

/* Install PHP packages module */
$ yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-opcache
$ yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-mysql php-opcache php-mcryp


//$ yum -y install php71-php-gd php71-php-ldap php71-php-odbc php71-php-pear php71-php-xml php71-php-xmlrpc php71-php-mbstring php71-php-snmp php71-php-soap curl curl-devel php71-php-mysql php71-php-opcache php71-php-mcrypt
//$ yum -y install php72-php-gd php72-php-ldap php72-php-odbc php72-php-pear php72-php-xml php72-php-xmlrpc php72-php-mbstring php72-php-snmp php72-php-soap curl curl-devel php72-php-mysql php72-php-opcache php72-php-mcrypt


config file
/etc/php.ini /*PHP 5*/


/*Display error and log , find "Error handling and loggin" */
error_reporting = E_All & ~E_NOTICE
display_errors = On

/* <?php to <? */
short_open_tag = On

#File Upload setting : should be : memory_limit > post_max_size > upload_max_filesize
file_uploads =On
upload_max_filesize = 128M
post_max_size = 128M
safe_mode off
mysql_sale_mode off
mysql_mas_perimit = 10

;;;;; Resource Limits ;;;;
max_execution_time = 300 ; Maximum execution time of each script, in seconds
max_input_time = 600 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume

;;;;; Date TimeZone;;;;
date.timezone = "Asia/Hong_Kong"


#****Also, if possible tell him to configure MySQL to the following: ****#
mysql.connect_timeout = 240


Apache
/etc/http/conf/httpd.conf

ServerName www.xibase.net:80
ServerAdmin webmaster@xibase.net
ServerTokens PROD
KeepAliveTimeout 45

AddDefaultCharset auto
chkconfig --leve 345 httpd on

/*server-status setting */
LoadModule status_module modules/mod_status.so /* default setting*/
ExtendedStatus On /* default setting*/
<Location /server-status> # 確定底下這幾行是存在的,約在 924 行左右!
SetHandler server-status
Order deny,allow
Deny from all
Allow from 192.168.1.0/24
Allow from 127.0.0.1
</Location>
/* http://hostname/server-status */

htaccess and htpasswd
# 確定底下這幾行是存在的,約在 400 行左右!
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>

# 在某個不受影響的地方加入這一段:
<Directory "/var/www/html/protect">
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>

cd /var/www/html/protect
root@www protect]#
vim .htaccess # 只要加入底下這幾行即可
AuthName "Protect test by .htaccess"
Authtype Basic
AuthUserFile /var/www/apache.passwd
require user test

這些參數的意義是這樣的:

  • AuthName:在要你輸入帳號與密碼的對話視窗中,出現的『提示字元』
  • AuthType:認證的類型,我們這裡僅列出 Apache 預設的類型,亦即是『basic』的啦
  • AuthUserFile:這個保護目錄所使用的帳號密碼設定檔。 也就是說,這個檔案是隨便你設定的,當然啦,所以使用者當然可以自行設定帳號與密碼囉。 檔案內的帳號不限在 /etc/passwd 出現的使用者!另外,這個檔案不要放置在 Apache 可以瀏覽的目錄內,所以我將他放置在首頁之外!避免被不小心竊取。
  • require:後面接可以使用的帳號。假如 /var/www/apache.passwd 內有三個帳號, 分別是 test, test1, test2 ,那我這裡只寫了 test ,因此 test1, test2 將無法登入此目錄。 如果要讓該密碼檔內的使用者都能夠登入,就改成『require valid-user』即可啊!
#htpasswd [-md] /var/www/apache.passwd <user_name>
-c :建立後面的密碼檔案。如果該檔案已經存在,則原本的資料會被刪除! 所以如果只是要新增使用者(檔案已存在時),不必加上 -c 的參數! -m
:不使用預設的 CRYPT 加密,改用 MD5 方式加密密碼!
-d :使用更複雜的 SHA 方式來加密!
-D :刪除掉後面接的那個使用者帳號!



/* for Virtual Hosts setting */
/*at httpd.conf bottom */
NameVirtualHost *:80
NameVirtualHost *:443
Options -Indexes
Include conf/vhosts/vhosts.conf /*virtusl hosts conf file */

/*at vhosts.conf */
<VirtualHost *:80>
ServerName web.xibase.net
ServerAlias web.xibase.net
DocumentRoot /var/www/html
ErrorLog logs/error_log-nanjing.istarnet.com.hk-log
CustomLog logs/access_log-nanjing.istarnet.com.hk-log common
HostNameLookups on
ServerAdmin interwebmaster@istarnet.com.hk
LogLevel emerg
AddDefaultCharset auto
LanguagePriority
Options -Indexes
</VirtualHost>

<VirtualHost *:80>
ServerName nanjing.org.hk
ServerAlias www.nanjing.org.hk
DocumentRoot /var/www/html/nanjing/nanjing.istarnet.com.hk
ServerAdmin interwebmaster@istarnet.com.hk
ErrorLog logs/error_log-nanjing.istarnet.com.hk-log
CustomLog logs/access_log-nanjing.istarnet.com.hk-log common
HostNameLookups on
LogLevel emerg
AddDefaultCharset auto
LanguagePriority
Options -Indexes
</VirtualHost>

########## https VirtualHost Setting ##############
<VirtualHost *:80>
ServerName sql.xibase.net
ServerAlias sql.xibase.net
Redirect / https://sql.xibase.net/
ServerAdmin interwebmaster@istarnet.com.hk
ErrorLog logs/error_log-nanjing.istarnet.com.hk-log
CustomLog logs/access_log-nanjing.istarnet.com.hk-log common
HostNameLookups on
LogLevel emerg
AddDefaultCharset auto
LanguagePriority
Options -Indexes
</VirtualHost>

<VirtualHost *:443>
ServerName sql.xibase.net
ServerAlias sql.xibase.net
DocumentRoot /var/www/html/phpsql
ErrorLog logs/error_log-sql.xibase.net
CustomLog logs/access_log-sql.xibase.net common
HostNameLookups on
ServerAdmin webmaster@xibase.net
LogLevel emerg
AddDefaultCharset auto
LanguagePriority
Options -Indexes
</VirtualHost>

<Directory /var/www/html/phpsql>
SSLRequireSSL
</Directory>
########## end of https VirtualHost Setting ##############

<Directory "/var/www/html/phpMyAdmin">
order deny,allow
deny from all
allow from 210.176.12.128/16
allow from 192.168.20.0/24
allow from 222.167.64.55
AuthType Basic
Satisfy all
</Directory>

Other Reditect setting for reference
Redirect Domain:

  • Redirect / http://www.new-domain.com/
    or
    Redirect permanent / http://www.new-domain.com/
  • Redirect Page:
    Redirect /web-page.html http://www.new-domain.com/destination-web-page.html
Setting up an SSL secured Webserver with CentOS 6
http://wiki.centos.org/HowTos/Https
yum install mod_ssl openssl
/*Generate private key */
cd /tmp/ /* first go to tmp folder */
#openssl genrsa -out ca.key 1024

/* Generate CSR */
#
openssl req -new -key ca.key -out ca.csr
/* Generate Self Signed Key */ #openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
/* Copy the files to the correct locations */ #cp ca.crt /etc/pki/tls/certs #cp ca.key /etc/pki/tls/private/ca.key #cp ca.csr /etc/pki/tls/private/ca.csr

restorecon -RvF /etc/pki

/* update ssl.conf file */
vi +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf

/*Change the paths to match where the Key file is stored. If you've used the method above it will be */
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key


/* Edit Virtual Host file ( vhosts.conf ) */
<VirtualHost *:80>
ServerName sql.xibase.net
ServerAlias sql.xibase.net
DocumentRoot /var/www/html/phpsql
Redirect / https://sql.xibase.net/
..............
</VirtualHost>

<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
<Directory /var/www/vhosts/yoursite.com/httpsdocs>
AllowOverride All
</Directory>
DocumentRoot /var/www/vhosts/yoursite.com/httpsdocs
ServerName yoursite.com
</VirtualHost>

/etc/rc.d/init.d/./httpd start

Hosts Setting
vi /ete/hosts
< ip# > < hostname >
e.g. 210.176.12.135     web.xibase.net

vi: /etc/sysconfig/network
hostname < hostname >
GATEWAT < ip#>
e.g. GATEWAT     192.168.10.254
PhpMyAdmin
download : http://www.phpmyadmin.net/home_page/downloads.php
change phpmyadmin login timeout
edit the file config.inc.php in folder <path of url>phpMyAdmin/
.add the following line

$cfg['blowfish_secret'] = 'ba17c1ec07d65003';

/* Extend phpmyadmin Authentication Timeout */
$cfg['LoginCookieValidity'] = 3600*4; // 4 hours, or 14400 seconds
Proftpd
Installation
$ wget ftp://ftp.servus.at/ProFTPD/historic/packages/RPMS/proftpd-1.2.10-1.fc1.i386.rpm
$ yum install libcrypto.so.4
$ rpm -Uvh proftpd-1.2.10-1.fc1.i386.rpm

vi /etc/proftpd.conf
-------------------------------------------------------------------------------------------------------------
ServerName "Main Xibase ProFTPD Default Installation"
ServerType standalone
DefaultServer on

#Do not perform ident nor DNS lookups (hangs when the port is filtered)
IdentLookups off
UseReverseDNS off

# Br use of SITE CHMOD by default
<Limit SITE_CHMOD>
AllowAll
</Limit>

DefaultRoot /var/www/html htmluser
------------------------------------------------------------------------------------------------------------

CentOS6 installation
for 64 bit
#wget http://pkgs.repoforge.org/proftpd/proftpd-1.3.4a-1.el6.rf.x86_64.rpm
for 32 bit
#wget http://pkgs.repoforge.org/proftpd/proftpd-1.3.4a-1.el6.rf.i686.rpm
# yum install libcrypto.so.6
#yum install perl-Mail-Sendmail

rpm -Uvh proftpd-1.3.4a-1.el6.rf.x86_64.rpm

/etc/proftpd.conf
------------------------------------------------------------------------------------------------------------
ServerName "Main Xibase ProFTPD Default Installation"
ServerType standalone
DefaultServer on
#Do not perform ident nor DNS lookups (hangs when the port is filtered)
IdentLookups off
UseReverseDNS of

DefaultRoot /var/www/html htmluser

comment the following lines if use /etc/passwd
#AuthPAMConfig proftpd
#AuthOrder mod_auth_pam.c* mod_auth_unix.c

or
http://www.vixual.net/blog/archives/775
------------------------------------------------------------------------------------------------------------


VsFtpd

Preloaded in Centos

/etc/vsftpd/vsftpd.conf #config file
/etc/vsftpd//ftpuser # Users that are not allowed to login via ftp(default)
/etc/vsftpd/user_list ## vsftpd userlist, If userlist_deny=NO, only allow users in this file, If userlist_deny=YES (default), never allow users in this file, and
#vim /etc/vsftpd/vsftpd.conf
----------------------------------------------------------------------------------------------------------------
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
#anonymous_enable=YES
anonymous_enable=NO

# Uncomment this to allow local users to log in.
local_enable=YES

# Uncomment this to enable any form of FTP write command.
write_enable=YES

# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=002

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list

# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES

# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
use_localtime=YES
banner_file=/etc/vsftpd/welcome.txt
local_root=/ftp_home #chk local root
user_config_dir=/etc/vsftpd/user_config_dir #directory of each user config file

#allow users only in user_list file
userlist_deny=NO
_____________________________________________________________________________________

cd /etc/vsftpd/user_config_dir
touch user1 # create each user config file in this directory


SAMBA
# edit /etc/samba/smb.conf
or
download sample smb
$ service smb start
$ service nmb start
port # udp 137:138 , tcp 139, 445

NTP
$ yum install ntp*
vi /etc/ntp.conf
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys

vi /etc/sysconfig/ntpd
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"
SYNC_HWCLOCK=yes # Set to 'yes' to sync hw clock after successful ntpdate

$ chkconfig ntpd on
$ service ntpd start
$ ntpstat # start sync, need about 15 mins

** if datetime is not correct **
$ rm /etc/localtime
$ cp /usr/share/zoneinfo/Hongkong /etc/localtime

 
Webmin
Download http://www.webmin.com/download.html
$ rpm -U web webmin-x.xxx-x..noarch.rpsm
edit /etc/webmin/miniserv.conf
port=xxxxx
$ service webmin restart

Upgrading to PHP5/MySQL5 under CentOS 4.5
$ yum --enablerepo centosplus install php-xml (if necessary)
$ yum update php --enable=centosplus
or
$ yum --enablerepo centosplus install php php-pear php-mysql mysql mysql-server
$yum --enablerepo centosplus install php-gd ( install GD lib)
 
GRUB set password
vi /boot/grub/grub.conf
add line under 'timeout=10'
"password=123456" /* set password */
Java and Flash Player

Installing Linux on Software RAID 1
Create RAID 1 for the boot file system and SWAP in DISK DRUD
After I pressed the “RAID” button, it gave me display only the radio “Create a software RAID partition” was active. I clicked the “OK” button, it gave a new display. I selected the “sda”, “Fixed size”, “Force to be a primary partition” and inputted “200” 

Then I clicked the “OK” button, it presented the previous screen. Click the “RAID” button again, selected the “sdb”, “Fixed size”, “Force to be a primary partition” and inputted “200”.

After I finished creating the software RAID partition, I clicked the “RAID” button again; it gave me a form that only the radio “Create a RAID device” was active. Click the “OK” button. In the next form, select “/boot” in “Mount Point” field, and select both “sda1”  and ”sdb1

Click the “OK” button, and then the RAID device was created.

In the same way, I created the RAID device for the “SWAP”. Then I created a RAID device for “LVM” (select LVM in File System Type).

Create LVM on RAID 1 for the root file system
After the LVM RAID had been created, I clicked the “LVM” button to create a volume group for the root system.

After that, click the “Next” button to continue the installation.


Enable both disks boot
After installation, I did the following to make the both disks bootable.
[joker@localhost ~]# grub
grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
 Checking if “/boot/grub/stage1” exists… no
 Checking if “/grub/stage1” exists… yes
 Checking if “/grub/stage2” exists… yes
 Checking if “/grub/e2fs_stage1_5 “ exists… yes
 Running “embed /grub/e2fs_stage1_5 (hd0)”… 28 sectors are embedded.
succeeded
 Running “install /grub/stage1 (hd0) (hd0)1+28 p
(hd0,0)/grub/stage2 /grub/grub.
conf”… succeeded
Done.
grub> root (hd1,0)
root (hd1,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
setup (hd1)
 Checking if “/boot/grub/stage1” exists… no
 Checking if “/grub/stage1” exists… yes
 Checking if “/grub/stage2” exists… yes
 Checking if “/grub/e2fs_stage1_5 “ exists… yes
 Running “embed /grub/e2fs_stage1_5 (hd1)”… 28 sectors are embedded.
succeeded
 Running “install /grub/stage1 (hd1) (hd1)1+28 p (hd1,0)/grub/stage2 /grub/grub.
conf”… succeeded
Done. 

Verify
[joker@localhost ~]# df –Th
Filesystem       Type    Size      Used    Avail    Use%   Mounted on
/dev/mapper/rootvg-root
                        ext4      6.7G    3.1G    3.3G    49%     /
/dev/md0          ext3      194M   14M     170M   8%       /boot
…  … 

[joker@localhost ~]$ cat /proc/mdstat
Personalities: [raid1]
md0 :   active raid1 sda1[0] sdb1[1]
            204736 blocks [2/2] [UU]
md1 :   active raid1 sda2[0] sdb2[1]
            1048512 blocks [2/2] [UU]
md2 :   active raid1 sda3[0] sdb3[1]
            11325376 blocks [2/2] [UU]

NFS
config file vi /ewtc/export
/data 192.168.1.0/255.255.255.0(rw, no_root, squash)
port 2049 , port map III

chkconfig --level 35 nfs on
chkrootkit and rkhunter

$ yum --enablerepo=epel -y install chkrootkit
$ yum install rkhunter
$ rkhunter --update


Quick Linux Server Installation



Copyright© 2025 Xibase Company