原文地址:
http://zhiwei.li/text/2010/07/debian-openvz-vps%E4%BC%98%E5%8C%96/
很多OpenVZ VPS提供商使用的debian 5的模板,使用的OpenVZ提供的标准模板, 其特点是占用内存非常小, 一般开机11M左右, 而Ubuntu的则超过80M
但Debian 还有优化的余地,因为它开了很多不必要的服务
用 dpkg -l | pager 查看当前安装的包
apache2
apache2-doc
apache2-mpm-prefork
apache2-utils
apache2.2-common
bind9
bind9utils
sendmail-base
sendmail-bin
sendmail-cf
sendmail-doc
stunnel
stunnel4
smbfs
samba-common
snmp
libsnmp-base
libsnmp15
libsensors3
libnss-ldap
talk
talkd
xinetd
x11-common
wwwconfig-common
tcpd
nscd
mysql-common
libmysqlclient15off
libldap-2.4-2
ldap-utils
fetchmail
dhcp3-client
dhcp3-common
用 ls -la /etc/rc2.d 查看启动的服务
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S10sysklogd -> ../init.d/sysklogd
lrwxrwxrwx 1 root 500 19 Jul 10 11:48 S10vzquota -> /etc/init.d/vzquota
lrwxrwxrwx 1 root root 13 Jul 10 11:47 S16ssh -> ../init.d/ssh
lrwxrwxrwx 1 root root 24 Jul 10 11:47 S20modules_dep.sh -> ../init.d/modules_dep.sh
lrwxrwxrwx 1 root root 15 Jul 10 11:47 S20rsync -> ../init.d/rsync (此服务删除)
lrwxrwxrwx 1 root root 19 Jul 10 11:47 S20saslauthd -> ../init.d/saslauthd (此服务删除)
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S20stunnel4 -> ../init.d/stunnel4 (此服务删除)
lrwxrwxrwx 1 root root 16 Jul 10 11:47 S20xinetd -> ../init.d/xinetd (此服务删除)
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S21sendmail -> ../init.d/sendmail (此服务删除)
lrwxrwxrwx 1 root root 14 Jul 10 11:47 S89cron -> ../init.d/cron
lrwxrwxrwx 1 root root 17 Jul 10 11:47 S91apache2 -> ../init.d/apache2 (此服务删除)
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S99rc.local -> ../init.d/rc.local
lrwxrwxrwx 1 root root 19 Jul 10 11:47 S99rmnologin -> ../init.d/rmnologin
lrwxrwxrwx 1 root root 23 Jul 10 11:47 S99stop-bootlogd -> ../init.d/stop-bootlogd
ls -la /etc/rcS.d
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S01glibc.sh -> ../init.d/glibc.sh
lrwxrwxrwx 1 root root 21 Jul 10 11:47 S02hostname.sh -> ../init.d/hostname.sh
lrwxrwxrwx 1 root root 24 Jul 10 11:47 S02mountkernfs.sh -> ../init.d/mountkernfs.sh
lrwxrwxrwx 1 root root 26 Jul 10 11:47 S04mountdevsubfs.sh -> ../init.d/mountdevsubfs.sh
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S05bootlogd -> ../init.d/bootlogd
lrwxrwxrwx 1 root root 19 Jul 10 11:47 S05keymap.sh -> ../init.d/keymap.sh
lrwxrwxrwx 1 root root 25 Jul 10 11:47 S08hwclockfirst.sh -> ../init.d/hwclockfirst.sh
lrwxrwxrwx 1 root root 22 Jul 10 11:47 S10checkroot.sh -> ../init.d/checkroot.sh
lrwxrwxrwx 1 root root 20 Jul 10 11:47 S11hwclock.sh -> ../init.d/hwclock.sh
lrwxrwxrwx 1 root root 17 Jul 10 11:47 S12mtab.sh -> ../init.d/mtab.sh
lrwxrwxrwx 1 root root 24 Jul 10 11:47 S18ifupdown-clean -> ../init.d/ifupdown-clean
lrwxrwxrwx 1 root root 27 Jul 10 11:47 S20module-init-tools -> ../init.d/module-init-tools
lrwxrwxrwx 1 root root 20 Jul 10 11:47 S30checkfs.sh -> ../init.d/checkfs.sh
lrwxrwxrwx 1 root root 16 Jul 10 11:47 S30procps -> ../init.d/procps
lrwxrwxrwx 1 root root 21 Jul 10 11:47 S35mountall.sh -> ../init.d/mountall.sh
lrwxrwxrwx 1 root root 15 Jul 10 11:47 S35quota -> ../init.d/quota
lrwxrwxrwx 1 root root 31 Jul 10 11:47 S36mountall-bootclean.sh -> ../init.d/mountall-bootclean.sh
lrwxrwxrwx 1 root root 26 Jul 10 11:47 S37mountoverflowtmp -> ../init.d/mountoverflowtmp
lrwxrwxrwx 1 root root 18 Jul 10 11:47 S39ifupdown -> ../init.d/ifupdown
lrwxrwxrwx 1 root root 20 Jul 10 11:47 S40networking -> ../init.d/networking
lrwxrwxrwx 1 root root 21 Jul 10 11:47 S45mountnfs.sh -> ../init.d/mountnfs.sh
lrwxrwxrwx 1 root root 31 Jul 10 11:47 S46mountnfs-bootclean.sh -> ../init.d/mountnfs-bootclean.sh
lrwxrwxrwx 1 root root 27 Jul 10 11:47 S48console-screen.sh -> ../init.d/console-screen.sh
lrwxrwxrwx 1 root root 21 Jul 10 11:47 S55bootmisc.sh -> ../init.d/bootmisc.sh
lrwxrwxrwx 1 root root 17 Jul 10 11:47 S55urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 24 Jul 10 11:47 S70screen-cleanup -> ../init.d/screen-cleanup
lrwxrwxrwx 1 root root 20 Jul 10 11:47 S70x11-common -> ../init.d/x11-common (此服务删除)
lrwxrwxrwx 1 root root 14 Jul 10 11:47 S75sudo -> ../init.d/sudo
lrwxrwxrwx 1 root root 30 Jul 10 11:47 S99stop-bootlogd-single -> ../init.d/stop-bootlogd-single
查看进程
# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1980 692 ? Ss 11:48 0:00 init [2]
root 5988 0.0 0.0 5272 1000 ? Ss 12:00 0:00 /usr/sbin/sshd
root 19658 0.0 0.1 8264 1552 ? Ss 11:49 0:00 sendmail: MTA: accepting connections
root 20242 0.0 0.0 2036 876 ? Ss 11:49 0:00 /usr/sbin/cron
root 20262 0.0 0.2 12924 2580 ? Ss 11:49 0:00 /usr/sbin/apache2 -k start
www-data 20264 0.0 0.2 13056 2500 ? S 11:49 0:00 /usr/sbin/apache2 -k start
root 24448 0.0 0.0 11204 356 ? Rs 11:53 0:00 vzctl: pts/0
root 24451 0.0 0.1 2764 1524 pts/0 Ss 11:53 0:00 -bash
root 26183 0.0 0.0 1692 604 ? Ss 11:48 0:00 /sbin/syslogd
root 26231 0.0 0.0 2352 872 ? Ss 11:48 0:00 /usr/sbin/xinetd -pidfile /var/run/xinetd.pid -stayalive -inetd_compat -inetd_ipv6
root 31895 0.0 0.0 2296 900 pts/0 R+ 12:12 0:00 ps aux
查看内存
# free
total used free shared buffers cached
Mem: 1048576 11500 1037076 0 0 0
-/+ buffers/cache: 11500 1037076
Swap: 0 0 0
删除 apache
# apt-get purge apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common
内存占用大大减少
# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1980 692 ? Ss 11:48 0:00 init [2]
root 5988 0.0 0.0 5272 1000 ? Ss 12:00 0:00 /usr/sbin/sshd
root 19658 0.0 0.1 8264 1552 ? Ss 11:49 0:00 sendmail: MTA: accepting connections
root 20242 0.0 0.0 2036 876 ? Ss 11:49 0:00 /usr/sbin/cron
root 24448 0.0 0.0 11204 356 ? Rs 11:53 0:00 vzctl: pts/0
root 24451 0.0 0.1 2764 1524 pts/0 Ss 11:53 0:00 -bash
root 26183 0.0 0.0 1692 604 ? Ss 11:48 0:00 /sbin/syslogd
root 26231 0.0 0.0 2352 872 ? Ss 11:48 0:00 /usr/sbin/xinetd -pidfile /var/run/xinetd.pid -stayalive -inetd_compat -inetd_ipv6
root 29933 0.0 0.0 2296 896 pts/0 R+ 12:14 0:00 ps aux
backup:/# free
total used free shared buffers cached
Mem: 1048576 6952 1041624 0 0 0
-/+ buffers/cache: 6952 1041624
Swap: 0 0 0
删除sendmail
# apt-get purge sendmail-base sendmail-bin sendmail-cf sendmail-doc
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
bsd-mailx* mailx* sendmail-base* sendmail-bin* sendmail-cf* sendmail-doc* sensible-mda*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
After this operation, 6279kB disk space will be freed.
删除xinetd
# apt-get purge xinetd talkd talk x11-common wwwconfig-common tcpd stunnel stunnel4 samba-common smbfs
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
groff* libice6* libsm6* libxaw7* libxext6* libxmu6* libxpm4* libxt6* samba-common* smbfs* stunnel* stunnel4* talk* talkd* tcpd* wwwconfig-common* x11-common* xinetd*
0 upgraded, 0 newly installed, 18 to remove and 0 not upgraded.
After this operation, 22.5MB disk space will be freed.
完成后,内存只占用
free
total used free shared buffers cached
Mem: 1048576 4608 1043968 0 0 0
-/+ buffers/cache: 4608 1043968
Swap: 0 0 0
继续删除
apt-get purge rsync sasl2-bin quota update-inetd portmap nscd mysql-common libsasl2-2 libmysqlclient15off libbind-dev bind9 bind9utils libbind9-40 ldap-utils libnss-ldap libldap-2.4-2 dhcp3-client dhcp3-common snmp libsnmp-base libsnmp15 procmail fetchmail
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
bind9* bind9utils* dhcp3-client* dhcp3-common* fetchmail* ldap-utils* libaprutil1* libbind-dev* libbind9-40* libcurl3* libldap-2.4-2* libmysqlclient15off* libnss-ldap* libpq5* libsasl2-2* libsnmp-base* libsnmp15* mysql-common* nscd*
portmap* procmail* quota* rsync* sasl2-bin* snmp* update-inetd*
分享到:
相关推荐
Linux VPS新手入门教程:KVM架构通过VNC安装Debian系统 对于初学者来说,了解和使用Linux VPS(Virtual Private Server)...随着对系统的熟悉和技能的提升,你可以进一步优化和扩展你的VPS环境,满足更多的应用需求。
到目前为止,Vtonf仅仅支持RedHat, Fedora, 和 CentOS(支持Debian正在计划中)。 CentOS-5.4-i386系统(Vtonf不支持x86-64的系统,安装过程会出错,在其INSTALL中也有说明) 1、关闭SELinux 打开setup界面–...
更新:[2018.04.03]功能合并:[ Linux VPS ] Debian/Ubuntu/CentOS 网络安装/重装系统/纯净安装 一键脚本[2018.03.30]优化GRUB检测测逻辑.添加组件依赖检测.修复一些已知BUG.[2018.03.25]优化判断逻辑.增加手动指定...
EUserv IPV6添加WARP IPV4项目(已测试通过Debian 10,Ubuntu 20.04,不支持Centos)脚本仅针对OpenVZ,LXC架构的IPV6 VPS,添加WARP IPV4网络支持,已设置IPV4优先详细的视频教程及探讨: : 步骤如下一,登陆SSH...
EUserv IPV6添加WARP IPV4项目(已测试通过Debian 10,Ubuntu 20.04)脚本仅针对OpenVZ,LXC架构的IPV6 VPS,添加WARP IPV4网络支持,已设置IPV4优先详细的视频教程及探讨: : 步骤如下一,登陆SSH(PC WIN系统)...
能够全自动重装Debian/Ubuntu/CentOS等系统. 同时提供dd安装镜像功能,例如: 全自动无救援dd安装windows系统 全自动安装CentOS时默认提供VNC功能,可使用VNC Viewer查看进度, VNC端口为 1 或者 5901 ,可自行尝试连接....