Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 142 lines (110 sloc) 3.86 KB
echo "nameserver 8.8.8.8" > /etc/resolv.conf
useradd -m ubuntu
passwd ubuntu
visudo
ubuntu  ALL=(ALL) NOPASSWD: ALL
%admin ALL=(ALL) NOPASSWD: NOPASSWD: ALL
sudo usermod -G admin -a ubuntu #废弃
#关闭使用密码登陆
vi /etc/ssh/sshd_config
#在root和ubuntu用户目录下分别:
mkdir .ssh
vim .ssh/authorized_keys
export LC_ALL=C
sudo apt-get update
sudo apt-get install make zsh git-core ruby1.9.3 mysql-server libmysqlclient-dev
sudo gem install rails -v 3.2.9 --no-ri --no-rdoc
#MySQL配置编辑: 事务表不忽略错误
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#安装ZSH
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
#在root用户下切换zsh
chsh -s /bin/zsh linode
#安装Erlang
sudo apt-get install fop libncurses5-dev openjdk-6-jdk unixodbc-dev g++ libssl-dev
mkdir -p download
cd download && wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz
tar -xvf otp_src_R16B03-1.tar.gz && cd otp_src_R16B03-1
./configure && make all && sudo make install
#安装HTTP服务器
sudo gem install passenger --no-ri --no-rdoc
sudo passenger-install-nginx-module
安装目录: /usr/local/nginx
#安装REDIS
wget http://download.redis.io/releases/redis-2.8.17.tar.gz
tar xzf redis-2.8.17.tar.gz && cd redis-2.8.17 && make && make install
sudo mkdir /etc/redis && sudo cp redis.conf /etc/redis/
########################安装postfix########################
sudo apt-get install postfix mailutils
#postfix配置界面
选择 Internet Site
System mail name编辑界面直接回车
#编辑postfix配置文件
sudo vi /etc/postfix/main.cf
为mydestination 添加 xxx.com
设置smtpd_use_tls=no
#重启使配置生效
sudo /etc/init.d/postfix reload
#####################################################
#monit监控
#####################################################
sudo apt-get install monit
#修改检测时间间隔为60秒
set daemon 60
#开启status summary 查看功能
set httpd port 2812 and
use address localhost
allow localhost
allow admin:monit
allow @monit
allow @user readonly
#在monit目录下的conf.d/目录下建立文件输入一下配置
check process mysql
with pidfile /var/run/mysqld/mysqld.pid
start program = "/bin/bash -c 'sudo service mysql start'"
stop program = "/bin/bash -c 'sudo service mysql stop'"
if failed port 3306 then restart
if 5 restarts within 5 cycles then timeout
check process nginx
with pidfile /var/run/nginx.pid
start program = "/bin/bash -c 'sudo /usr/local/nginx/sbin/nginx'"
stop program = "/bin/bash -c 'sudo /usr/local/nginx/sbin/nginx -s stop'"
if failed port 9090 then restart
if 5 restarts within 5 cycles then timeout
check process redis matching "redis-server"
start program = "/bin/bash -c 'sudo -u linode redis-server /etc/redis/redis.conf'"
stop program = "/usr/bin/killall redis-server"
if failed port 6379 then start
if 5 restarts within 5 cycles then timeout
check process erlang_en001 matching "-sname en001"
start program = "/bin/bash -c 'cd /home/linode/apps/en001 && sudo -u linode make deamon'"
stop program = "/bin/bash -c 'cd /home/linode/apps/en001 && sudo -u linode make stop'"
if failed port 5555 then start
if 5 restarts within 5 cycles then timeout
#重新加载配置
sudo monit reload
#查看监控信息
sudo monit status
#添加开机自启动
sudo vi /etc/rc.local
sudo service monit start
#####################################################
#时区
sudo dpkg-reconfigure tzdata
#非常重要
vim /etc/default/rcS
UTC=no
sudo ntpdate ntp.ubuntu.com
date 检查时间
sudo hwclock --systohc
sudo vim /etc/security/limits.conf
ubuntu        -    nofile      1006154
sudo vim /etc/sysctl.conf
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 5000 65000
fs.file-max = 8061540
Jump to Line
Something went wrong with that request. Please try again.