最近在学习一些服务器上面的操作,记录一下遇到的问题备查。
软件安装
CentOS使用yum管理软件包,基本操作和apt类似。
Docker
准备用Docker来配置Hadoop等环境,先安装配置Docker
yum -y install docker #安装docker
等待安装完成后,运行docker run hello-world
看是否安装正确。
结果输出一条错误信息
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
搜到的原因是docker服务没启动,使用systemctl start docker
尝试启动服务,报错
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
使用systemctl status docker -l
检查出错的原因
Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disabl...nabled=false)
答案是这台机器的linux的内核中的SELinux不支持 overlay2 graph driver。也给出了两个解决方法,一是启动新的内核,二是禁用SELinux。这里先禁掉,具体操作是将配置文件的“--selinux-enabled”改成“--selinux-enabled=false”,然后再重启docker。
配置文件地址:
Centos :/etc/sysconfig/docker
Ubuntu :/etc/default/docker
OPTIONS='--selinux-enabled=fasle
使用systemctl enable docker
启用服务,重新运行docker run hello-world
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
9db2ca6ccae0: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
Status: Downloaded newer image for docker.io/hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
然后用docker pull将Hadoop镜像下载到本地备用。
jupyter notebook
使用conda管理python环境,安装只需要conda install jupyter
,之后为了方便远程登录,设置一下密码。
1.生成配置文件
$jupyter notebook --generate-config
Writing default config to: /home/sangyj/.jupyter/jupyter_notebook_config.py
2.设置密码
$python
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:6ecaf7be97c9:fbfde7333b19e692a****cd9cafb3aec'
** 3.修改配置**
将生成的密码添加到~/.jupyter/jupyter_notebook_config.py
,另外配置默认不打开本机浏览器。
c.NotebookApp.password = u'sha1:xxx:xxx'
c.NotebookApp.open_browser = False
** 4.配置防火墙**
sudo firewall-cmd --zone=public --add-port=8888/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-ports