Closed youngjuning closed 4 years ago
$ sudo passwd root
$ sudo passwd --unlock root
修改 /etc/lightdm/lightdm.conf
为:
[Seat:*]
greeter-session=unity-greeter
user-session=ubuntu
autologin-user=root
allow-guest=false #不允许guest登录
在 /root/.profile
文件中将 mesg n||true
修改为 tty -s && mesg n ||true
ubuntu 默认的sshd
的设置不允许root
用户用密码远程登录
$ nano /etc/ssh/sshd_config
作如下修改:
- PermitRootLogin prohibit-password
+ PermitRootLogin yes
$ systemctl enable vncserver-x11-serviced.service #systemd
$ update-rc.d vncserver-x11-serviced defaults #initd
$ raspi-config
进入之后找到 ssh 服务,开启即可。
$ sudo apt install nodejs-legacy
$ sudo apt install npm
$ sudo npm install -g n
详细使用参考:https://github.com/youngjuning/youngjuning.github.io/issues/88#issuecomment-441446806
$ sudo n latest
$ sudo n stable // 推荐这个
$ sudo n lts
$ npm i -g npm@latest
$ node -v
$ npm -v
最快捷
$ curl -sSL https://get.docker.com | sh
国内镜像【未测试】
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun
// docker客户端
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:57:21 2018
OS/Arch: linux/arm
Experimental: false
// docker服务端 - 社区版
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:17:57 2018
OS/Arch: linux/arm
Experimental: false
// 如果你不想用root账号使用 Docker,你应该把你的用户加入到 “docker” 分组中(安装过程中已经新建了docker分组)
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
// 记住你必须退出并重新登录才能生效
Remember that you will have to log out and back in for this to take effect!
// 警告:将用户添加到“docker”组将授予运行容器的能力,这些容器可用于获取docker主机上的root权限。
WARNING:
Adding a user to the "docker" group will grant the ability to run containers which can be used to obtain root privileges on the docker host.
// 参考资源
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface for more information.
总结:
root
账号操作docker
,就在 "docker" 分组下添加user(重启后生效)使用Docker的准时轻量级开发环境
$ apt-get install docker-compose
默认情况下,docker
命令会使用 Unix socket 与 Docker 引擎通讯。而只有 root
用户和 docker
组的用户才可以访问 Docker 引擎的 Unix socket。出于安全考虑,一般 Linux 系统上不会直接使用 root
用户。因此,更好地做法是将需要使用 docker
的用户加入 docker
用户组。
$ sudo usermod -aG docker $USER // 一般是 pi
# 如果没有该分组就新建 sudo groupadd docker
退出当前终端并重新登录
$ sudo systemctl enable docker
$ sudo systemctl start docker
$ docker run arm32v7/hello-world // 树莓派
$ docker run hello-world
执行以上命令,若能正常输出以下信息,则说明安装成功。
Unable to find image 'arm32v7/hello-world:latest' locally
latest: Pulling from arm32v7/hello-world
ad0f38092cf2: Pull complete
Digest: sha256:f1ee3cbf1dbeab65f6b542360aca910ce1f6ba0ff31c803fdf08a13f5f846249
Status: Downloaded newer image for arm32v7/hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm32v7)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
请在 /etc/docker/daemon.json
中写入如下内容(如果文件不存在请新建该文件)
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
注意,一定要保证该文件符合 json 规范,否则 Docker 将不能启动。
之后重新启动服务。
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
配置加速器之后,如果拉取镜像仍然十分缓慢,请手动检查加速器配置是否生效,在命令行执行 docker info
,如果从结果中看到了如下内容,说明配置成功。
Registry Mirrors:
https://registry.docker-cn.com/
Portainer
在Docker
引擎或Swarm
集群上作为轻量级Docker
容器(Docker
映像权重小于4MB)运行。因此,在使用Docker
的任何计算机上运行容器都是一个命令。
使用以下Docker命令部署Portainer:
$ docker volume create portainer_data
$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
您只需要使用浏览器访问运行portainer
的Docker
引擎的端口9000
。
注意:该-v /var/run/docker.sock:/var/run/docker.sock
选项只能在Linux环境中使用。
WARNING: No swap limit support
: http://t.cn/ELVlq0A、http://t.cn/ELVT2DhWARNING: No kernel memory limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No cpuset support
配置之后 firefox 打不开了!!!!
在中国玩树莓派真是各种苦逼,github慢的要死,各种软件源慢的要死……之前树莓派装的Raspbian,无奈国内的软件源不全,很多软件包自动跳到官方源,简直无法使用,于是换了Ubuntu Mate,虽然官方的软件源能用,但也很慢,找了一番,发现国内为Ubuntu on ARM 搭建的镜像站还真少,我目前只找到一个~~~
/etc/apt/sources.list
,至于用什么打开随意http://ports.ubuntu.com/
全部替换为 http://mirrors.ustc.edu.cn/ubuntu-ports/
,这是中科大的sudo apt-get update
和 sudo apt-get upgrade
测试打开一个镜像站点,然后以此打开 /dists/xenial/main/
,看这个目录下面有没有 binary-arm
这样的字眼,如果有,就是提供arm支持的
$ mate-panel --reset
装机
参考 https://github.com/youngjuning/youngjuning.github.io/issues/190#issue-383201802
更新