code-server
- code-server is a cloud ide platform, which can enable us to code through browser anywhere. But how to set up the code-server on ubuntu 18.04
- Eeee, to practice my English, I prefer to using English in my blog, unless there is something I can’t express by using my poor English.
Introduction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| mkdir ~/code-server cd ~/code-server proxychains wget https://github.com/cdr/code-server/releases/download/v3.12.0/code-server-3.12.0-linux-amd64.tar.gz
tar -xzvf code-server-3.12.0-linux-amd64.tar.gz
mv code-server-3.12.0-linux-amd64 code-server
rm -rf /usr/lib/code-server
cp -r code-server /usr/lib/code-server
ln -s /usr/lib/code-server/code-server /usr/bin/code-server
mkdir /var/lib/code-server
vi /lib/systemd/system/code-server.service
|
填入以下内容
1 2 3 4 5 6 7 8 9 10 11 12
| [Unit] Description=code-server After=nginx.service
[Service] Type=simple Environment=PASSWORD=your_password ExecStart=/usr/bin/code-server --bind-addr 127.0.0.1:8080 --user-data-dir /var/lib/code-server --auth password Restart=always
[Install] WantedBy=multi-user.target
|
启动
1 2 3
| systemctl start code-server systemctl enable code-server systemctl status code-server
|
export
使用nginx使得外网可以访问
1
| vi /etc/nginx/sites-available/code-server
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| server { listen 80; listen [::]:80;
server_name code-server.your-domain;
location / { proxy_pass http://localhost:8080/; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; } }
|
1 2 3 4
| ln -s /etc/nginx/sites-available/code-server /etc/nginx/sites-enabled/code-server
nginx -t systemctl restart nginx
|
Securing Your Domain
1 2 3 4 5 6
| add-apt-repository ppa:certbot/certbot apt install python-certbot-nginx ufw allow https ufw reload certbot
|
code-server 3.9.3之后的版本在markdown preview 时滚轮不同步。