centos
CentOS快速安装lamp和ftp
1、Apache
yum update
yum install httpd
cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup
vi /etc/httpd/conf.d/vhost.conf
NameVirtualHost serverIP :80
<VirtualHost domain.com:80>
ServerAdmin domain@domain.com
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/domain.com/public_html/
ErrorLog /var/www/domain.com/logs/error.log
CustomLog /var/www/domain.com/logs/access.log combined
</VirtualHost>
IP直接访问
<VirtualHost serverIP:80>
ServerName serverIP
DocumentRoot /var/www/html/
</VirtualHost>
mkdir -p /var/www/domain.com/public_html
mkdir -p /var/www/domain.com/logs
/etc/init.d/httpd start
/etc/init.d/httpd reload
/sbin/chkconfig –levels 235 httpd on
2、 MySQL
yum install mysql-server
/sbin/chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start
/etc/init.d/mysqld reload
mysql_secure_installation
mysql -u root -p
create database dbsample;
grant all on dbsample.* to ‘dbuser’ identified by ’dbpassword’;
quit
3、PHP
yum install php php-pear php-mysql
vi /etc/php.ini
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php.log
max_execution_time = 300
memory_limit = 64M
register_globals = Off
4、FTP
yum -y install vsftpd
service vsftpd start
chkconfig –level 35 vsftpd on
netstat -tl
禁止匿名用户
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
设定 ftp 目录
chgrp -R ftp /var/www
chmod -R 777 /var/www
增加 ftp 用户
adduser –d /var/www –g ftp –s /sbin/nologin usersample
passwd usersample
service vsftpd restart
全部搞定
。
Cento安装L2TP/IPSec VPN
yum install -y ppp gmp xl2tpd lsof
32位
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://openswan.org/download/binaries/centos/5/without-nss/openswan-2.6.24rc5-1.i386.rpm
rpm -ivh openswan-2.6.24rc5-1.i386.rpm
64位
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
wget http://openswan.org/download/binaries/centos/5/without-nss/openswan-2.6.24rc5-1.x86_64.rpm
rpm -ivh openswan-2.6.24rc5-1.x86_64.rpm
vi /etc/sysctl.conf
修改
net.ipv4.ip_forward = 1
添加
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
sysctl -p
service ipsec start
ipsec verify查看
除了最后一个,其他均需要OK
Checking your system to see if IPsec got installed and started correctly:
Version check and ipsec on-path [OK]
Linux Openswan U2.6.24rc5/K2.6.18-164.11.1.el5xen (netkey)
Checking for IPsec support in kernel [OK]
Testing against enforced SElinux mode [OK]
NETKEY detected, testing for disabled ICMP send_redirects [OK]
NETKEY detected, testing for disabled ICMP accept_redirects [OK]
Checking for RSA private key (/etc/ipsec.secrets) [OK]
Checking that pluto is running [OK]
Pluto listening for IKE on udp 500 [OK]
Pluto listening for NAT-T on udp 4500 [OK]
Two or more interfaces found, checking IP forwarding [OK]
Checking NAT and MASQUERADEing
Checking for ‘ip’ command [OK]
Checking for ‘iptables’ command [OK]
Opportunistic Encryption Support [DISABLED]
vi /etc/ipsec.conf
version 2.0
config setup
nat_traversal=yes
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12
oe=off
protostack=netkey
conn L2TP-PSK-NAT
rightsubnet=vhost:%priv
also=L2TP-PSK-noNAT
conn L2TP-PSK-noNAT
authby=secret
pfs=no
auto=add
keyingtries=3
rekey=no
type=transport
left=YOUR.SERVER.IP.ADDRESS
leftprotoport=17/1701
right=%any
rightprotoport=17/%any
vi /etc/ipsec.secrets
YOUR.SERVER.IP.ADDRESS %any: PSK "YourSharedSecret"
service ipsec restart
vi /etc/xl2tpd/xl2tpd.conf
[global]
listen-addr = YOUR.SERVER.IP.ADDRESS
ipsec saref = yes
[lns default]
ip range = 192.168.8.2-192.168.8.101
local ip = 192.168.8.1
;require chap = yes
refuse pap = yes
refuse chap = yes
require authentication = yes
name = l2tpd
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
vi /etc/ppp/options.xl2tpd
require-mschap-v2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
asyncmap 0
auth
crtscts
lock
hide-password
modem
debug
name l2tpd
proxyarp
vi /etc/ppp/chap-secrets
test * test *
service xl2tpd start
(xl2tpd -D 查错)
service iptables start
iptables -t nat -A POSTROUTING -s 192.168.8.0/24 -o eth0 -j MASQUERADE
service iptables save
service iptables restart
chkconfig --list
chkconfig ipsec on
chkconfig xl2tpd on
iptables -I RH-Firewall-1-INPUT 10 -p udp -m udp --dport 1701 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 10 -p udp -m udp --dport 4500 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 10 -p udp -m udp --dport 500 -j ACCEPT
OK!
其他的一些参考配置
1、修改/etc/xl2tpd/xl2tpd.conf,内容如下:
mkdir /etc/xl2tpd
cp examples/xl2tpd.conf /etc/xl2tpd/
vi /etc/xl2tpd/xl2tpd.conf
[global]
listen-addr = 192.168.1.67
port=1701
auth file=/etc/ppp/chap-secrets #// 有l2tp-secret auth file = /etc/xl2tpd/l2tp-secrets
[lns default]
ip range = 192.168.9.128-192.168.9.254
local ip = 192.168.9.99
require chap = yes
refuse pap = yes
require authentication = yes
name = LinuxVPNserver
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
2、修改/etc/ppp/options.xl2tpd,内容如下:
cp examples/ppp-options.xl2tpd /etc/ppp/options.xl2tpd
vi /etc/ppp/options.xl2tpd
ipcp-accept-local
ipcp-accept-remote
ms-dns 192.168.1.1
ms-dns 192.168.1.3
ms-wins 192.168.1.2
ms-wins 192.168.1.4
noccp
auth
crtscts
idle 1800
mtu 1410
mru 1410
nodefaultroute
debug
lock
proxyarp
connect-delay 5000
Random Posts
Tags
Recent Comments
- 流云雨蝶 on 100 Best Classics Two
- can on 100 Best Maria Callas 卡拉丝名唱百分百
- Passioning on Lisa Ono 小野丽莎 – Dans Mon Île 左岸香颂
- tzewei on 《US Billboard 2009 Year-End Hot 100 Songs》(2009年美国公告牌流行金榜百首)
- Lord on 100 Best Encores