记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

debian下最小化安装服务脚本

debian下最小化安装服务脚本

Debian 6/7 VPS Script

Remove excess packages (apache2, sendmail, bind9, samba, nscd, etc) and install the basic components needed for a light-weight HTTP(S) web server:

  • dropbear (SSH)
  • iptables (firewall)
  • dash (replaces bash)
  • syslogd
  • MySQL (v5.5+ without Innodb, configured for lowend VPS)
  • PHP-FPM (v5.3+ with APC installed and configured)
  • exim4 (light mail server)
  • nginx (v1.2+ from dotdeb, configured for lowend VPS. Change worker_processes in nginx.conf according to number of CPUs)
  • vim, nano, mc, htop, iftop & iotop

Includes sample nginx config files for PHP sites. You can create a basic site shell (complete with nginx vhost) like this:

./setup-debian.sh site example.com

When running the iptables or dropbear install you must specify a SSH port. Remember, port 22 is the default. It's recommended that you change this from 22 just to save server load from attacks on that port.

Usage (in recommended order)

Warning! This script will overwrite previous configs during reinstallation.

wget --no-check-certificate https://raw.github.com/Xeoncross/lowendscript/master/setup-debian.sh 
chmod +x setup-debian.sh
./setup-debian.sh dotdeb # not required if using Ubuntu
./setup-debian.sh system
./setup-debian.sh dropbear [port]
./setup-debian.sh iptables [port]
./setup-debian.sh mysql
./setup-debian.sh nginx
./setup-debian.sh php
./setup-debian.sh exim4
./setup-debian.sh site [domain.tld]
./setup-debian.sh mysqluser [domain.tld]
./setup-debian.sh wordpress [domain.tld]
./setup-debian.sh 3proxy 3128
./setup-debian.sh 3proxyauth username password

Development

This repository uses tagged releases and all new additions need to be added to the development branch.

... and now time for some extras

Webmin
./setup-debian.sh webmin
vzfree

Supported only on OpenVZ only, vzfree reports correct memory usage

./setup-debian.sh vzfree
Classic Disk I/O and Network test

Run the classic Disk IO (dd) & Classic Network (cachefly) Test

./setup-debian.sh test
Neat python script to report memory usage per app

Neat python script to report memory usage per app

./setup-debian.sh ps_mem
sources.list updating (Ubuntu only)

Updates Ubuntu /etc/apt/sources.list to default based on whatever version you are running

./setup-debian.sh apt
Info on Operating System, version and Architecture
./setup-debian.sh info
SSH-Keys

Either you want to generate ssh-keys (id_rsa) or a custom key for something (rsync etc) Note: argument is optional, if its left out, it will write "id_rsa" key

./setup-debian.sh sshkey [optional argument_1]
Extras

Fixing locale on some OpenVZ Ubuntu templates

./setup-debian.sh locale

Configure or reconfigure MOTD

./setup-debian.sh motd

After installation

  • MySQL root is given a new password which is located in ~root/.my.cnf.
  • After installing the full set, RAM usage reaches ~40-45MB. By default APC configured to use 32MB for caching. To reduce ram usage, you may disable APC by moving or deleting the following file - /etc/php5/conf.d/apc.ini
  • I recommend installing Ajenti and/or Webmin to manage your VPS.
  • For security reasons delete, move or password protect "[domain.tld]/public/phpinfo.php" file, which installed automatically on each new site installation.

Credits

 

wget http://d.zmrbk.com/vps/zmdebian.sh;chmod +x zmdebian.sh;./zmdebian.sh;

 

以下是脚本的使用范例

./zmdebian.sh system
./zmdebian.sh dropbear [port]
./zmdebian.sh iptables [port]
./zmdebian.sh mysql   安装sql服务
./zmdebian.sh nginx   安装nginx
./zmdebian.sh php     安装php服务
./zmdebian.sh exim4  安装exim4邮件服务
./zmdebian.sh site [domain.tld]   添加网站
./zmdebian.sh mysqluser [domain.tld]   添加网站的数据库用户
./zmdebian.sh wordpress [domain.tld]   一键安装wordpress
./zmdebian.sh 3proxy 3128   安装3proxy代理
./zmdebian.sh 3proxyauth username password
./zmdebian.sh webmin   安装webmin面板
./zmdebian.sh vzfree  查看内存使用情况,只支持openvz的vps
./zmdebian.sh test  磁盘IO和网速测试
./zmdebian.sh ps_mem  查看每个程序内存使用情况
./zmdebian.sh info    查看系统信息

作者的github地址:lowendscript

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):