前端之家收集整理的这篇文章主要介绍了
ubuntu14.04服务器基本环境初始化,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
sudo vim /etc/security/limits.conf
文件尾追加
* hard nofile 1000000
* soft nofile 1000000
sudo apt-get install language-pack-zh-hans
sudo vim /etc/default/locale
添加
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
LC_ALL="en_US.UTF-8"
生效
source /etc/profile
sudo useradd jtsa -m -s /bin/bash
sudo passwd jtsa
sudo usermod -a -G sudo jtsa
sudo useradd jtserver -m -s /bin/bash
sudo passwd jtserver
sudo usermod -a -G sudo jtserver
sudo useradd jtjt -m -s /bin/bash
sudo passwd jtjt
sudo vim /etc/ssh/sshd_config 允许密码登录
将PasswordAuthentication改为yes
将Port改为36000
sudo service ssh restart
四、登录jtserver,添加ssh公钥和秘钥、添加authorized_keys
ssh-keygen -t rsa -C "jitui@jituia.com"
vim ~/.ssh/authorized_keys 添加本地电脑id_rsq.pub
chmod 600 ~/.ssh/authorized_keys
五、修改hostname
sudo vim /etc/hostname改为aws
sudo vim /etc/hosts添加127.0.0.1 aws
生效hostname sudo hostname -F /etc/hostname
重新登录
sudo add-apt-repository ppa:vbernat/haproxy-1.7
sudo apt-get update
sudo apt-get install haproxy
haproxy -v
sudo add-apt-repository ppa:Nginx/stable
sudo apt-get update
sudo apt-get install Nginx
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
八、python环境
[supervisor deb包下载](http://ftp.debian.org/debian/pool/main/s/supervisor/)
sudo dpkg -i supervisor_3.3.1-1_all.deb
sudo apt-get install python-pip python-dev build-essential
sudo apt-get install uwsgi uwsgi-plugin-python
sudo apt-get install uwsgi-plugin-python3
九、redis安装
sudo apt-get install -y python-software-properties
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install -y redis-serve
十、ssh登录
eval "$(ssh-agent -s)"
ssh-keygen -t rsa -C "test@jituia.com"
- 把专用密钥添加到 ssh-agent 的高速缓存中
ssh-add ~/.ssh/id_rsa
- ssh设置不用密码登陆,复制本地id_rsa.pub追加到到服务器.ssh/authorized_keys
sudo vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
chmod 755 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
sudo service ssh restart
问题
1.Depends: init-system-helpers (>= 1.18~) b
wget http://launchpadlibrarian.net/173841617/init-system-helpers_1.18_all.deb
sudo dpkg -i init-system-helpers_1.18_all.deb
wget -O- http://neuro.debian.net/lists/trusty.cn-bj1.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
sudo apt-get update
sudo apt-get install init-system-helpers
2.supervisor depends on python-meld3
sudo apt-get install python-meld3
3.保存ssh长链接
服务器/etc/ssh/sshd_config添加
ClientAliveInterval 60
ClientAliveCountMax 5
本地服务器/etc/ssh/sshd_config添加
Host *
TCPKeepAlive yes
ServerAliveInterval 60
4.修改服务器时区
一、运行tzselect,在这里我们选择亚洲 Asia,确认之后选择中国(China),最后选择北京(Beijing)
sudo tzselect
二、复制文件到/etc目录下
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
三、更新时间,cn.pool.ntp.org是位于中国的公共NTP服务器
sudo ntpdate cn.pool.ntp.org
原文链接:https://www.f2er.com/ubuntu/352397.html