差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
tech:op:ubuntu:install [2017/03/18 20:54:14]
某喵
tech:op:ubuntu:install [2018/07/09 16:30:14] (当前版本)
某喵
行 1: 行 1:
-<​markdown>​+# Ubuntu 14.04 服务器搭建最简 check list
  
-#### Ubuntu 14.04 服务器搭建最简 check list+## 步骤
  
-1、使用 root 用户 ssh 登录+### 1、使用 root 用户 ssh 登录
  
-2、创建新用户,并给其 `sudo` 权限+### 2、创建新用户,并给其 `sudo` 权限
 ``` ```
 adduser newbie adduser newbie
行 11: 行 11:
 ``` ```
  
-3、切换到新用户,并配置 ssh key+### 3、切换到新用户,并配置 ssh key
 ``` ```
 su - newbie su - newbie
行 20: 行 20:
 ``` ```
  
-4、修改 sshd_config+### 4、修改 sshd_config
 ``` ```
-vi /​etc/​ssh/​sshd_config +sudo vi /​etc/​ssh/​sshd_config
-service ssh restart+
 ``` ```
  
-Port 4917 # change ssh port(optinal) +Port 4917 # change ssh port(optinal)
-AllowUsers newbie # restrict root login+
  
  
-#### Refs 
  
-- [Server Hacks New Ubuntu 14.04 Server Checklist](https://​laravel-china.org/​topics/​542)+> AllowUsers newbie # restrict only newbie can login through ssh
  
-</markdown>+``` 
 +sudo service ssh restart 
 +``` 
 + 
 + 
 +### 5、简单配置 ufw 
 +``` 
 +sudo ufw allow {port}/tcp  
 +sudo ufw show added 
 +sudo ufw enable 
 +``` 
 + 
 +### 6、设置 PS1 
 +``` 
 +txtred='​\[\033[0;​31m\]'​ # Red 
 +txtylw='​\[\033[0;​33m\]'​ # Yellow 
 +txtrst='​\[\033[0m\]' ​   # Text Reset 
 + 
 +PS1="​\u@${txtylw}\h${txtrst}:​${txtred}\w${txtrst}$ " 
 +``` 
 + 
 +### 7、更改 hostname 
 +``` 
 +sudo vi /​etc/​hostname 
 +sudo service hostname start 
 +``` 
 + 
 +### 8、更改 ssh welcome message 
 + 
 +- /etc/motd: The classic, static file. Does not exist anymore in Ubuntu 16.04 LTS, not even as a symbolic link to /​var/​run/​motd. If it is created, however its contents will be printed too. 
 + 
 + 
 + 
 +> - /​var/​run/​motd:​ This was used by Ubuntu’s first implementation. It is not used anymore. It is just ignored by PAM. 
 + 
 + 
 + 
 +> - /​var/​run/​motd.dynamic:​ This is what is shown on login currently. It is updated by /​etc/​init.d/​motd at every boot. It is also updated by PAM by running the scripts in /​etc/​update-motd.d/,​ if they exist. 
 + 
 + 
 + 
 +> - /​etc/​motd.tail:​ The Ubuntu package used to populate /​etc/​update-motd.d. One of them would cat the contents of this file so it was easy to add static content. That script does not exist in the package anymore, so the file does not have the intended effect. 
 + 
 +主要修改以下两处文件 
 + 
 +- /etc/motd 
 +- /​etc/​update-motd.d/​ 下面的文件 
 + 
 +see this [post](https://​ownyourbits.com/​2017/​04/​05/​customize-your-motd-login-message-in-debian-and-ubuntu/​) 
 + 
 +## 使用 zsh 
 + 
 +### 安装 
 + 
 +``` 
 +sudo apt-get update 
 +sudo apt-get install zsh 
 +curl -L https://​raw.github.com/​robbyrussell/​oh-my-zsh/​master/​tools/​install.sh | sh 
 +chsh -s /bin/zsh 
 +``` 
 + 
 +### 设置 
 +``` 
 +cd .oh-my-zsh/​custom/​plugins 
 +git clone git@git.panezhang.cn:​z-zsh.git 
 +``` 
 + 
 +修改 .zshrc 
 + 
 +- 主题:blinks 
 +- 插件:z-zsh 
 + 
 +--- 
 + 
 +## 备注 
 + 
 +- 使用 docker 时,需要在 `/​etc/​docker/​daemon.json` 中加入 `"​iptables":​ false`,否则 ufw 的配置会失效。 
 + 
 +## Refs 
 + 
 +- [Server Hacks New Ubuntu 14.04 Server Checklist](https://​laravel-china.org/​topics/​542) 
 +- [Ubuntu Linux 中安裝 Zsh 及 Oh-my-zsh](http://​blog.poetries.top/​2016/​06/​26/​Ubuntu%E4%B8%8B%E5%AE%89%E8%A3%9D-Zsh-%E5%8F%8A-Oh-my-zsh/​) 
 +- [docker/​issues/​4737](https://​github.com/​docker/​docker/​issues/​4737)