Linode VPS的配置文章收录
星期四, 三月 18, 2010 0:33
344次浏览 暂无评论
- Linode VPS配置
从diahosting搬迁到linode了,学习到很多VPS的知识,这里把网上收集的VPS配置知识做一个摘抄。
Linode系统安装完后,升级一下系统,使系统保持在最新的状态。
在windows系统中用SSH
windows用户可以下载 PuTTY一个win2000及以后系统的SSH客户端,在第一次使用PuTTY,你将看到一个登录对话框在”Host Name”输入框中输入你的Linode IP地址,点击”Open”,你将收到一个关于主机key不知道的警告,点击”Yes”继续进行,它将缓存SSH key。
运行安全更新
一旦你登录,你将想立即运行安全更新,这样做有助于抵挡因为在包中未解决的安全漏洞而对你Linode未经授权的访问。
- Debian
- apt-get update
- apt-get upgrade --show-upgraded
- Ubuntu
- sudo apt-get update
- sudo apt-get upgrade --show-upgraded
- CentOS/Fedora
- yum update
设置主机名
现在你将为你的系统设置主机名,你可以选择任何你喜欢的名字,但是一些独特的有描述性的可能更好些,主机名是你机器的自称,你可以选择任何你想的,比如在这个例子中,我们叫它”squire”
echo “squire” > /etc/hostname
hostname -F /etc/hostname
安装CentOS系统后,安装Kloxo后台,就可以得到完美的运行环境了。包括Apache+Mysql+zend+FTP+Mail。很方便。
一.首先先升级下系统:
yum update
yum install gcc* automake* make*
yum install lib* python* perl*
mkdir -p /home/software
cd /home/software
然后下载kloxo系统,安装:
wget http://download.lxlabs.com/download/kloxo/production/kloxo-install-master.sh
sh ./kloxo-install-master.sh
安装完成啦!!
现在可以登录拉。
二.但是登陆进去加dns的时候会出现no_ip_address的错误,修改一下这里
/etc/sysconfig/network-scripts/ifcfg-eth0
Linode VPS默认情况下是通过DHCP自动获取IP的,所以在安装Kloxo完成设置Kloxo的时候会出现no_ip_address的提示,这个时候就需要手动设置上IP,这样才能添加域名。
如果你设置Kloxo的时候出现no_ip_address的提示你可以按照下面步骤修改:
使用编辑器编辑:/etc/sysconfig/network-scripts/ifcfg-eth0
# Configuration for eth0
DEVICE=eth0
BOOTPROTO=none
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
# eth0 – This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary.
IPADDR=12.34.56.78 #你的IP地址
NETMASK=255.255.255.0 #子网掩码
GATEWAY=12.34.56.1 #网关
一般这样设置好,再执行命令:service network restart 重启网络就好了。
添加第2个IP,可以创建 /etc/sysconfig/network-scripts/ifcfg-eth0:0
# Configuration for eth0:0
DEVICE=eth0:0
BOOTPROTO=none
# This line ensures that the interface will be brought up during boot.
ONBOOT=yes
# eth0:0
IPADDR=34.56.78.90
NETMASK=255.255.255.0
添加第3个IP,创建 /etc/sysconfig/network-scripts/ifcfg-eth0:1 按上面的内容添加到这个文件中,以此类推。
以上办法都是在CentOS或者Fedora下添加IP的方法,如果是在Debian/Ubuntu下添加IP的方法(注,当然Kloxo没有Debian下的版本):
修改 /etc/network/interfaces
# The loopback interface
auto lo
iface lo inet loopback
# Configuration for eth0 and aliases
# This line ensures that the interface will be brought up during boot.
auto eth0 eth0:0 eth0:1
# eth0 – This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary.
iface eth0 inet static
address 12.34.56.78
netmask 255.255.255.0
gateway 12.34.56.1
# eth0:0
iface eth0:0 inet static
address 34.56.78.90
netmask 255.255.255.0
# eth0:1 – Private IPs have no gateway (they are not publicly routable) so all you need to
# specify is the address and netmask.
iface eth0:1 inet static
address 192.168.133.234
netmask 255.255.128.0
保存,重启网络,/etc/init.d/networking restart 即可。
===============================================
安装kloxo中文语言包教程
1.使用ssh登陆您的VPS
2.进入lang目录:
cd /usr/local/lxlabs/kloxo/httpdocs/lang
3.下载语言包:
wget http://www.hostloc.com/pack/lxadmin_cn_pack.zip
4.解压:
unzip lxadmin_cn_pack.zip
(如果没有安装unzip命令请执行yum -y install unzip进行安装)
5. 访问http://你的IP:7778/ 进行lxadmin语言设置
在Appearance->Language里选择Chinese,然后点击update确认.如下图所示:
==================
wget出现failed: Temporary failure in name resolution.下载失败
主要原因为本地DNS信息错误,可以修改wim /etc/resolv.conf,
找到nameserver项修改成下面的,没有的话添加下面的
nameserver 4.2.2.4
nameserver 4.2.2.2
使用的Level3的name server。
然后esc,然后:wq
=============安全配置=========================
centos系统安全设置
1、更改SSH端口,最好改为10000以上,别人扫描到端口的机率也会下降
vi /etc/ssh/ssh_config
vi /etc/ssh/sshd_config
然后修改为port为需要的端口号
以root身份service sshd restart
2、删除系统臃肿多余的账号:
userdel adm
userdel lp
userdel sync
userdel shutdown
userdel halt
userdel news
userdel uucp
userdel operator
userdel games
userdel gopher
userdel ftp 如果你不允许匿名FTP,就删掉这个用户帐号
groupdel adm
groupdel lp
groupdel news
groupdel uucp
groupdel games
groupdel dip
groupdel pppusers
3、增加普通账号,并禁止root远程登录:
useradd newuser //添加新用户
passwd newuser //修改密码
usermod -G10 newuser
或usermod -G wheel newuser //将用户加入wheel组,允许使用 su – 命令提权成root
vi /etc/ssh/sshd_config
添加一行:
PermitRootLogin no //禁止root远程登录
vi /etc/pam.d/su
#auth required /lib/security/$ISA/pam_wheel.so use_uid ← 找到此行,去掉行首的“#”
echo “SU_WHEEL_ONLY yes” >> /etc/login.defs //以上为禁止不在wheel组的用户使用su -命令
重启sshd服务
#service sshd restart
4、更改下列文件权限,使任何人没有更改账户权限:
chattr +i /etc/passwd
chattr +i /etc/shadow
chattr +i /etc/group
chattr +i /etc/gshadow
5、编辑“host.conf”文件(vi /etc/host.conf)加入下面这些行:
order bind,hosts
multi on
nospoof on
chmod 600 /etc/xinetd.conf
vi /etc/xinetd.conf 禁止所有不需要的服务,如:ftp、telnet、shell、login、exec、talk、ntalk、imap、pop-2、pop-3、finger、auth等等,也可以直接通过setup命令来设置服务项。
改变了“inetd.conf”文件之后,别忘了给inetd进程发一个SIGHUP信号:
killall -HUP xinetd
chattr +i /etc/xinetd.conf //把inetd.conf设成不可改变,如果要改变xinetd.conf文件,你必须先清除这个不允许改变的标志:
chattr -i /etc/inetd.conf
又是为了服务器安全,可以配置防ping:
先用/sbin/ifconfig查看网卡信息,找到外网网卡名字,如venet0
运行
/sbin/iptables -A OUTPUT -o venet0 -p icmp -j ACCEPT
/sbin/iptables -A INPUT -i venet0 -p icmp –icmp-type echo-reply -j ACCEPT
/sbin/iptables -A INPUT -i venet0 -p icmp –icmp-type echo-request -j DROP
/sbin/service iptables save
看到OK后重启即可。
也可以通过使用MySQLTuner分析优化MySQL。MySQLTuner是一个Perl脚本,用来分析你的MySQL性能,并给出优化建议。
下载,执行:
# wget http://mysqltuner.com/mysqltuner.pl
# chmod +x mysqltuner.pl
# ./mysqltuner.pl
——————————- 第三步 ——————————-
安装kloxo
wget http://download.lxlabs.com/downl … o-install-master.sh
sh ./kloxo-install-master.sh
yum install php-bcmath /*高精度数学运算组件,默认没安装,MD5运算时用到*/
yum check-update /*检查全部更新*/
yum update /*更新全部更新*/
yum clean all /*清理全部缓存的安装文件以节省空间*/
这就安装完了kloxo,可以web登陆面板了。
地址:https://yourdomain:7777/ /*安全连接*/
http://yourdomain:7778/ /*普通链接,常用*/
一般出于安全考虑要在面板里修改掉默认的7777和7778端口,修改后要ssh里运行:
/script/restart
重启kloxo服务使之生效。
