Docker 上安装 centos 6.8 ,然后安装桌面环境及vncserver远程查询国外网站.
1. 创建centos 6 的 docker
1 2 3 | docker run -it --privileged -d -e "container=docker" -p 8071:22 -p 8072:80 -p 8073:443 -p 8074:5901 -p 8075:1080 --restart always imagine10255/centos6-lnmp-php56 /bin/bash docker ps -a docker attach 5a3adf677a89 //进入容器 |
2-1. 查看centos版本:
1 | cat /etc/redhat-release |
2-2. 返回如下信息:
1 | CentOS release 6.8 (Final) |
2-3. 查看centos版本:
1 | rpm -q centos-release |
2-4. 返回如下信息:
1 | centos-release-6-8.el6.centos.12.3.x86_64 |
2-5. 修改 CentOS-Base.repo 配置
1 | vi /etc/yum.repos.d/CentOS-Base.repo |
2-6. 换成如下信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | [base] name=CentOS-6.8 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.8 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.8 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 |
2-7. 修改 epel.repo 配置
1 | vi /etc/yum.repos.d/epel.repo |
2-8. [epel]信息修改如下
1 2 3 4 5 6 7 | [epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/epel-archive/6/$basearch gpgcheck=0 gpgkey=http://mirrors.cloud.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6 |
2-8. yum 更新
1 | yum update -y |
3-1. 安装tigervnc-server
1 | yum install tigervnc-server -y |
3-2. 启动VNC
1 | vncserver //启动vnc ,输入两次密码 |
3-3. 修改配置文件
1 | vi /root/.vnc/xstartup //编辑配置文件,我保持默认 |
1 | vi /etc/sysconfig/vncservers |
1 | VNCSERVERS="1:root" |
3-4. 重启vnc服务
1 | service vncserver restart |
4-1. 安装桌面环境
1 2 3 | yum groupinstall "Desktop" -y //安装GNOME桌面环境 yum groupinstall "X Window System" -y //安装xwindow yum groupinstall "Chinese Support" -y //安装中文支持 |
4-2. 修改配置
1 | vi /etc/inittab |
1 | id:3:initdefault //改为 id:5:initdefault |
4-3. 重启vncserver
1 | service vncserver restart |
4-4. 已经看到可以正常进入了
5-1. 安装remi源
1 | rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm |
(注意:官网上源可能会有跟新变化,导致说找不到对应rpm文件,可以先在浏览器上进入http://download.fedoraproject.org/pub/epel/6/i386/ 搜索一下与epel-release-6-8.noarch.rpm相近的包,如果有,改为相应版本号的包,比如改为epel-release-6-7.noarch.rpm等)
这步好像报错,但没影响.
1 | rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |
(如果找不到,解决方法同上)
5-2. 更新或安装Firefox
1 2 | yum --enablerepo=remi install firefox -y //安装 yum --enablerepo=remi update firefox -y //更新 |
5-3. 打开浏览器