Tag Archive: a2b2


這兩天在webhostingtalk和idcspy到處都充斥著vaserv(a2b2,cheapvps,fsckvps的)旗下所有VPS節點因為hypervm漏洞被黑,我自己的fsckvps vps所在的server43服務器數據全丟,還好,之前已經把站點移到了starkvps上。

聽說可以陪2個月,其實也無所謂了,倒是Hypervm開發公司的老總LXLAB的Kt Ligesh在家自殺身亡讓人覺得非常的可惜,希望他在天堂能一切都好.其實挺好的一個軟件,除了界面不是很好看外,對于用戶來說很實用,授權也很便宜,現在這麽一來,不知道hypervm今後的命運將會如何,廉價VPS提供商是否還能和之前一樣提供價廉質美的VPS産品呢,我們只能拭目以待。

回到a2b2的怀抱

最近starkvps.com的xen vps两次莫名当机,发ticket过去都是给我重启,没说明原因,让人很恼火,本来不想换的,但是这样的稳定性实在是让人郁闷,虽然这款VPS我已经用了大半年了,一直很稳定,LA机房的速度也很OK,就在idcspy上普遍反映连国外主机速度不行丢包的情况下,我的vps依然坚挺,可是现在。。。。。。

昨晚一咬牙,买了1G Plan的fsckvps.com的vps,fsckvps是a2b2的一个新的提供umanaged vps的品牌,他们的vps质优价廉,可谓童叟无欺,更让人很爽的是,我分到的服务器用的是Xeon X3350四核的新服务器,性能不错,现在跑起来我的blog绝对飞快,就这样定居了吧,呵呵。月底20号starkvps考虑下续费不续费,毕竟我对这个vps充满了感情,价格好便宜,$15/m,有40G Disk ,768M RAM 500G BANDWIDTH 双Xeon 5405的CPU,实在不行就让他退居二线了,呵呵,我真的有点俺舍不得。。。。。。

下面给fsckvps.com做个广告,嘻嘻,想要物美价廉vps的点击一下图片就可以购买了:)

我购买的是a2b2.com去年年底在webhostingtalk.com促销的VPS型号,配置为equal share共享CPU 4核Core2Quad Q9300,50G Raid硬盘 1G保证内存,2G最大内存,1TB/月的流量,自己用WHT上流行的VPS测试工具unixbench-4.1.0-wht测试过,VPS得分482分,可谓非常高,现在已经用了第二个月了,非常稳定:)这家公司在WHT上是非常有名的VPS主机提供商,不用担心后续服务问题,他们时常在wht上有促销,如果您等不及想买他们性价比超高的VPS,也可以他们最近在美国开的新低价VPS站点fsckvps.com,他们承诺快速建立您的VPS,可谓立等可取,呵呵。

因为OPENVZ社区对Gentoo Linux的不够重视,现在大部分提供openvz vps的提供商都只有20060317的镜像,不管是i386还是amd64的,这个镜像可谓非常古老,要升级到最新版本会遇到数不清的错误,比如ssh默认不开启,升级后会遇到认证key错误无法连接的情况,虽然都能一一解决,但过程十分痛苦。如果有钱的话还是去买XEN的VPS吧对Gentoo的支持非常好,版本一般至少也为2007.0的不会遇到这些胸闷的“意外”问题,看上去和真实的系统更像。我嘛,就是嫌XEN的VPS太贵,而a2b2提供2008的gentoo镜像,所以选择了openvz现在也逐渐适应了,但是开始安装之中也遇到了一点问题,听我来慢慢细说一回;)

1.编辑网卡配置文件,重启网卡和ssh服务

首先,我在HyperVM(一个授权便宜,好用的VPS控制面板,可用于XEN和OPENVZ)里格式化系统为amd64的gentoo linux 2008.0,ssh发现连接不上,还好,hypervm提供了console access以便在您操作失误被防火墙或者其他错误导致无法远程连接的时候可以连进系统修复,我连进去一看,原来是/etc/conf.d/net完全没有定义导致虚拟网卡没起来,真晕,看来有了新的镜像,openvz依然不够重视这系统,解决方法自然有,自己照葫芦画瓢呗:

config_venet0=("67.222.132.152/24" "67.222.132.100/24")
routes_venet0=("default via 67.222.132.1")

config_venet0行定义VPS的IP,这里可以添加自己VPS拥有的IP,有2个就填2个,有N个就N个,国外IP便宜一般也就$1一个,哈哈。routes_venet0行定义你VPS的网关,一般也就是你IP前三位最后改为1。在console里/etc/init.d/net.venet0启动网卡,再执行/etc/init.d/sshd start启动ssh服务之后我们就可以正常连接VPS了。

2.解决emerge时解压后遇到touch xxx failed的错误

这也是典型的VPS kernel版本限制所导致的问题,总所周知,VPS无论OPENVZ,还是XEN或Virtuozzo,都不能在VPS里自行升级kernel,除了少数几家XEN VPS,比如linode和provps在其自家开发的VPS控制面板上提供了kernel版本选择。现在VPS主机提供商基本都是用CENTOS 5.x为其NODE也就是物理服务器系统,其内核为26.18.xxx,这也导致了我们gentoo vps内核的版本“低下”,touch failed这个文件不解决的话,接下去你一个package软件包都emerge不了,系统等于和废了没什么两样。在google上搜索,在bug.gentoo.org上找到了解决方案,这是由于coreutils-6.12检查kenrel和kernel header版本是否一致导致的,现在a2b2提供的版本kernel header版本wei2.6.27,而我们kernel的版本只有区区2.6.18,好无奈,还好用个超简单的方法给解决了,amd64系统下载x86系统下载,建立/usr/portage/package/All目录,将下载好的文件放入此目录,然后降级安装coreutils包就能解决问题。为了在gentoo推出解决该bug的补丁更新前,防止以后升级coreutils包覆盖现有版本,最后我们还要做一步vi /etc/portage/package.mask加入>sys-kernel/gentoo-sources-2.6.17-r2 >sys-kernel/linux-headers-2.6.17-r2 >sys-apps/coreutils-6.10-r3

3.正式emerge升级系统前的热身工作,磨刀不误砍柴工嘛,嘻嘻:

A.首先我们要去掉系统默认的make.profile,制定我们需要的,这里既然要拿gentoo vps做服务器,当然要选择server的咯:

rm /etc/make.profile
ln -s /usr/portage/profiles/default/linux/amd64/2008.0/server /etc/make.profile

B.精简删除不必要的portage软件包,只留下为安装服务器软件有用的包:

cd /usr/portage
rm -rf a* d* g* e* h* j* k* l* m* n* perl-core r* s* v* w* x*

在/etc/make.conf里加入PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes",排除emerge –sync时不同步我们不需要的包,/etc/portage/rsync_excludes文件参考如下:

net-news
www-client
net-im
net-irc
net-wireless
sys-freebsd
net-print
net-dialup
dev-tex
dev-ml
dev-texlive
dev-tcltk
gnustep-*
dev-embedded
dev-games
dev-dotnet
app-office
app-doc
app-emulation
app-accessibility
app-cdr/
app-emacs/
app-laptop/
app-mobilephone/
app-pda/
app-xemacs/
games-*/
gnome-*/
kde-*/
media-fonts/
media-gfx/
media-plugins/
media-radio/
media-sound/
media-tv/
media-video/
rox-*/
sci-*/
x11-*/
xfce-*/

C.接下来安装mirrorselect,选择离您VPS最快速的网络以便在下载包时取得理想的速度:

emerge mirrorselect
mirrorselect -D -s 3 -b 10 >> /etc/make.conf

D.调整系统时区:
先要在HyperVM控制面板里将TimeZone调整为Asia/Shanghai,然后在VPS里

rm /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

在shell下打date命令看看是不是时区已经OK了?

E.一些make.conf里的调整优化系统参数:
a.我自己用的USE

USE="-apache2 -cli -fontconfig -berkdb -ldap -ipv6 -doc -X -gtk -gnome -kde -qt -esd -arts -alsa -sdl cjk nls unicode hardened"

b.gcc优化参数

CFLAGS="-march=nocona -fomit-frame-pointer -O2 -pipe -mno-tls-direct-seg-refs"
CXXFLAGS="${CFLAGS}"

c.ACCEPT_KEYWORDS="~amd64",这里我们之所以选择~amd64而不是更稳定的amd64,是因为此gentoo镜像建立的日期为20081113,里面的系统已经使用~amd64的keywords建立,如果倒退到amd64的话,降级所遇到的问题会非常多,也不利于系统的稳定,所以不推荐用amd64。

F.个性化调整emerge 包的USE和版本KEYWORDS等
a./etc/portage/package.use

>=dev-php5/eaccelerator-0.9.5.1 session contentcache disassembler inode
>=www-servers/lighttpd-1.4.19-r2 ipv6 pcre ssl bzip2 fam fastcgi gdbm lua memcache mysql php
>=dev-db/mysql-5.0.54 big-tables cluster extraengine max-idx-128
>=dev-lang/php-5.2.6_rc3 ctype force-cgi-redirect hash mhash ncurses pcre iconv session crypt bzip2 cgi curl exif ftp gd-external json mysql mysqli odbc pdo simplexml sockets ss$
>=media-libs/gd-2.0.35 jpeg png truetype

b./etc/portage/package.mask

>sys-apps/coreutils-6.10-r3

4.emerge -e world更新完整个系统后,我们对LLMPPT的配置正式开始啦:

A.一步到位安装所有所需服务器软件包:
emerge lighttpd php mysql-community pure-ftpd djbdns supervise-scripts && HTTPD_USER="lighttpd" HTTPD_GROUP="lighttpd" emerge dev-php5/eaccelerator
这里需要注意的是djbdns即tinydns,supervise-scripts是djbdns的守护进程包,在emerge dibdns前建议手动加入组nofilesaddgroup nofiles
我们使用lighttpd作为web服务器,那么在安装eaccelerator这个php加速器时一定要加上 HTTPD_USER="lighttpd" HTTPD_GROUP="lighttpd"否则emerge时就会报错。

B.开始对LLMPPT逐一配置:

a.MySQL:
emerge --config mysql-community
/etc/init.d/mysql startskip-innodb
rc-update add mysql default
为了节省mysql运行的内存开销数,我们需要去除mysql对innodb的支持:
vi /etc/mysql/my.cnf
skip-innodb之前的#去除然后重启mysql

b.PHP:
vi /etc/php/cgi-php5/php.ini
post_max_size = 2M upload_max_filesize = 2M都改为8M,以方便以后在线上传的php程序,比如用wordpress上传图片,用phpmyadmin上传还原数据库等
最后将memory_limit = 8M的限制改为128M或者256M以便我们的站点可以用更多的内存支持php程序脚本

c.pure-ftpd:
groupadd ftpgroup增加ftpgroup这个组
useradd -g ftpgroup -d /dev/null -s /etc ftpuser建立属于ftpgroup组的用户ftpuser,并设置
pure-pw useradd joe -u ftpuser -d /home/ftpusers/joe
pure-pw mkdb

然后编辑/etc/conf.d/pureftpd文件,按照自己的需求配置好pure-ftpd,下面是我的配置文件:

# Config file for /etc/init.d/pure-ftpd
##Comment variables out to disable its features, or change the values in it... ##

## This variable must be uncommented in order for the server to start ##
IS_CONFIGURED="yes"

## FTP Server,Port (separated by comma) ##
## If you prefer host names over IP addresses, it's your choice:
## SERVER="-S ftp.rtchat.com,21"
## IPv6 addresses are supported.
## !!! WARNING !!!
## Using an invalid IP will result in the server not starting,
## but reporting a correct start!
## SERVER="-S 192.168.0.1,21"
## By default binds to all available IPs.
SERVER="-S 21"

## Number of simultaneous connections in total, and per IP ##
MAX_CONN="-c 10"
MAX_CONN_IP="-C 2"

## Start daemonized in background ##
DAEMON="-B"

## Don't allow uploads if the partition is more full then this var ##
DISK_FULL="-k 90%"

## If your FTP server is behind a NAT box, uncomment this ##
#USE_NAT="-N"

## Authentication mechanisms (others are 'pam', ...) ##
## Further infos can be found in the README file.
AUTH="-l puredb:/etc/pureftpd.pdb"

## Change the maximum idle time (in minutes) ##
## If this variable is not defined, it will default to 15 minutes.
#TIMEOUT="-I '"

## Facility used for syslog logging ##
## If this variable is not defined, it will default to the 'ftp' facility.
## Logging can be disabled with '-f none'.
#LOG="-f "

## Charset conversion support *experimental* ##
## Only works if USE "charconv" is enabled (only Pure-FTPd >=1.0.21).
## Set the charset of the filesystem.
# CHARCONV="--fscharset "

## If you want to process each file uploaded through Pure-FTPd, enter the name
## of the script that should process the files below.
## man pure-uploadscript to learn more about how to write this script.
# UPLOADSCRIPT="/path/to/uploadscript"

## Misc. Others ##
MISC_OTHER="-w -E -x -i -j -Z"

#
# Use these inside $MISC_OTHER
# More can be found on "http://download.pureftpd.org/pub/pure-ftpd/doc/README"
#
# -A [ chroot() everyone, but root ]
# -e [ Only allow anonymous users ]
# -E [ Only allow authenticated users. Anonymous logins are prohibited. ]
# -i [ Disallow upload for anonymous users, whatever directory perms are ]
# -j [ If the home directory of a user doesn't exist, auto-create it ]
# -M [ Allow anonymous users to create directories. ]
# -R [ Disallow users (even non-anonymous ones) usage of the CHMOD command ]
# -x [ In normal operation mode, authenticated users can read/write
# files beginning with a dot ('.'). Anonymous users can't, for security reasons
# (like changing banners or a forgotten .rhosts). When '-x' is used, authenticated
# users can download dot-files, but not overwrite/create them, even if they own
# them. ]
# -X [ This flag is identical to the previous one (writing
# dot-files is prohibited), but in addition, users can't even *read* files and
# directories beginning with a dot (like "cd .ssh"). ]
# -D [ List files beginning with a dot ('.') even when the client doesn't
# append the '-a' option to the list command. A workaround for badly
# configured FTP clients. ]
# -G [ Disallow renaming. ]
# -d [ Send various debugging messages to the syslog. ONLY for DEBUG ]
# -F [ Display a fortune cookie on login. Check the README file ]
# -H [ By default, fully-qualified host names are logged. The '-H' flag avoids host names resolution. ]

最后/etc/init.d/pure-ftpd start启动pure-ftpd,然后加入自启动rc-update add pure-ftpd default

d.TinyDNS:
指定tinydns监听的IP,这里x.x.x.x指您VPS的IP
tinydns-conf tinydns dnslog /etc/tinydns x.x.x.x
建立一个软连接让svscan可以监tinydns的运行状况
ln -s /etc/tinydns /service/tinydns
进入/service/tinydns/root,就可以开始添加您的DNS解析记录了
cd /service/tinydns/root
./add-ns example.com y.y.y.y
make
下面有个tinydns解析配置文件的范例,可以参考一下,路径为/service/tinydns/root/data,编辑data文件即可,编辑完毕执行make命令让变更的解析记录生效。

Zpablasso.com:pablasso.com.:pablasso.com.:2005100111:28800:7200:604800:3600:3600
#name server
&pablasso.com::ns1.pablasso.com.:3600
&pablasso.com::ns2.pablasso.com.:3600
#full domain
=pablasso.com:64.79.194.86:3600
# MX record (mail)
pablasso.com:64.79.194.86:a::60
#aditional
+mail.pablasso.com:64.79.194.86:3600
+ns1.pablasso.com:64.79.194.86:3600
+ns2.pablasso.com:64.79.194.86:3600
+www.pablasso.com:64.79.194.86:3600

e.lighttpd
编辑/etc/lighttpd/lighttpd.conf
以下的配置文件是我自己用的,供大家参考修改(一些需要的注意的地方我会红字标注):

Powered by WordPress and Motion by 85ideas.
12 queries. 0.702 seconds.