Ubuntu 16.04系统布署小记

Posted 永远的阿哲

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 16.04系统布署小记相关的知识,希望对你有一定的参考价值。

前段时间趁着双11打折,又将阿里云主机续费了3年。之前布署的系统是Ubuntu 12.04,从系统发布到现在也有四年半了,其官方支持的生命周期也将止于明年春,且这在几年里出现了很多新的事物,我也需要跟上时代的步伐,于是着手将整个环境更新至最新的Ubuntu 16.04,现将布署过程记录如下

 

系统布署

环境布署

应用布署

 

10. 停止服务器实例,选择更换系统盘,选择Ubuntu 16.04 64bit,重启实例

 

20. 挂载虚拟内存

mkdir /swap && cd /swap && fallocate -l 2g 2GB.swap && mkswap 2GB.swap && swapon 2GB.swap && echo "# # # Swap File # # #" >> /etc/fstab && echo "/swap/2GB.swap    none                   swap               sw                       0       0" >> /etc/fstab && mount -a

How To Add Swap Space on Ubuntu 16.04

Does it make sense to create swap partitions for new installations nowadways?

How to increase swap space?

 

30.重新挂载阿里云数据盘

echo /dev/xvdb1  /opt ext4    defaults    0  0 >> /etc/fstab && moute -a

步骤 4:格式化和挂载数据盘

 

40. 新增个人用户

adduser ljz
gpasswd -a ljz sudo

后面的操作使用新用户完成

 

50. 更新软件源

sudo vim /etc/apt/sources.list

可以看到,阿里已经帮我将源指向了阿里镜象自己,这也是最快的选择,所以不需要作任何修改

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb http://mirrors.aliyuncs.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse

 

更新软件源

sudo apt update

升级软件

sudo apt upgrade

What is the difference between apt and apt-get?

 

60. 解决异常关机后重动时的卡顿

打开引导配置文件

sudo vim /etc/default/grub

增加异常停顿时间参数

GRUB_RECORDFAIL_TIMEOUT=2

保存退出后,更新启动配置

sudo update-grub

How can I force Ubuntu to boot on a stuck boot menu?

Force ubuntu to boot after power failure without user input

 

70. 安装常用工具

sudo apt install axel zip unzip tree screen

Axel替代wget

How to list all the files in a tree (a directory and its subdirs)?

SSH远程会话管理工具 - screen使用教程

 

80. vim设置

sudo vim /etc/vim/vimrc

在打开的文件最后输入下面的内容

set nu
set ai

保存。这样vim显示时就自动显示行号,也能自动缩进了

vim显示行号、语法高亮、自动缩进的设置

以上是关于Ubuntu 16.04系统布署小记的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 16.04应用布署小记

Ubuntu 16.04 安装Mysql 5.7 踩坑小记

在 Ubuntu16.04上安装并使用Docker

ubuntu16.04下搭建织梦源码网站步骤

Dokuwiki布署小记

[转]okuwiki布署小记