升级linux内核(2.6.32->3.10.81),安装docker
1.内核升级环境准备
#查看已经安装的和未安装的软件包组,来判断我们是否安装了相应的开发环境和开发库;
yum grouplist
#一般是安装这两个软件包组,这样做会确定你拥有编译时所需的一切工具
yum groupinstall "Development Tools"
#你必须这样才能让 make *config 这个指令正确地执行
yum install ncurses-devel
#如果你没有 X 环境,这一条可以不用
yum install qt-devel
#创建 CentOS-6 内核时需要它们
yum install hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
2.开始升级内核:
cd /usr/src/linux-3.10.81
#复制原内核配置
cp /boot/config-2.6.32-71.el6.x86_64 .config
vim .config
/*将如下内容 追加入.config 并保存
CONFIG_NF_NAT_IPV4=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_AUFS_FS=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_OVERLAY_FS=y
CONFIG_CGROUP_PERF=y
CONFIG_CFS_BANDWIDTH=y
HYPERVISOR_GUEST=y
CONFIG_VMWARE_BALLOON=m
*/
#编辑内核配置,开启内核CGROUP支持
make menuconfig
#选择General setup-->Control Group support->Memory Resource Controller for Control Groups选中
#自动整理.config
sh -c ‘yes "" | make oldconfig‘
#编译并安装内核(j8代表8个线程同时编译,请根据你的机器情况设置)
make -j8 bzImage && make -j8 modules && make -j8 modules_install && make install
vim /etc/grub.conf
修改default=0保存。即选择从你新编译的内核启动linux。
#重启
reboot
#注意:重新编译内核请运行
cd /usr/src/linux-3.10.81
make mrproper
make clean
3.安装docker
#启动后
uname -r
返回3.10.81表示内核安装并启动成功
#rehl的docker安装说明https://docs.docker.com/installation/rhel/
#如下是安装说明的简化:
#a.下载docker的rpm
wget https://get.docker.com/rpm/1.7.0/centos-6/RPMS/x86_64/docker-engine-1.7.0-1.el6.x86_64.rpm
#本地安装rpm包
sudo yum localinstall --nogpgcheck docker-engine-1.7.0-1.el6.x86_64.rpm
#启动docker服务
sudo service docker start
#docker image
4.FAQ有两个问题还没有解决
ERRO[0000] [graphdriver] prior storage driver "devicemapper" failed: exit status 1
FATA[0000] Error starting daemon: error initializing graphdriver: exit status 1
#1.prior storage driver "devicemapper" failed: exit status 1
yum upgrade device-mapper-libs
#error initializing graphdriver
sudo yum install -y http://mirror.centos.org/centos/6.6/os/x86_64/Packages/device-mapper-libs-1.02.90-2.el6.x86_64.rpm http://mirror.centos.org/centos/6.6/os/x86_64/Packages/device-mapper-1.02.90-2.el6.x86_64.rpm http://mirror.centos.org/centos/6.6/os/x86_64/Packages/device-mapper-event-1.02.90-2.el6.x86_64.rpm http://mirror.centos.org/centos/6.6/os/x86_64/Packages/device-mapper-event-libs-1.02.90-2.el6.x86_64.rpm https://dl.fedoraproject.org/pub/epel/testing/6/x86_64/docker-io-1.6.2-1.el6.x86_64.rpm
5.安装aufs文件系统
cd /etc/yum.repos.d
wget http://www.hop5.in/yum/el6/hop5.repo
yum install kernel-ml-aufs
docker -d -s aufs #使用aufs文件系统启动docker服务
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-10 15:09:57