Installing the DevKit Using code-server
Prerequisites
- The Kunpeng DevKit has been installed (see Installation). Only Kunpeng servers are supported.
- Do not enable the proxies because the server proxy and code-server proxy conflict with each other. Check that the firewall is disabled.
Note that the code-server environment screenshots provided in this section may be different from the actual ones.
Procedure
- Generate the certificate. If the certificate has been prepared, skip this step.code-server must be accessed through HTTPS and it requires the browser to trust the certificate. In a local test, you can generate a self-signed root certificate, import it to the OS, and use the root certificate to issue the code-server certificate. In this way, the browser trusts code-server.
In a production environment, use a trusted HTTPS certificate.
- Generate the root certificate and private key.
1 2
openssl genrsa -out ca.key 4096 openssl req -new -x509 -sha256 -days 360 -subj "/C=CN/CN=code-server-ca" -key ca.key -out ca.crt
- Download ca.crt and import it to a trusted root certificate authority of the browser. For details, see steps 2 to 10 in Importing a Root Certificate for the Kunpeng DevKit.
The root certificate needs to be generated and imported only once. You can use the same root certificate to issue other server certificates.
- Issue the code-server certificate.
openssl genrsa -out cert.key 4096 openssl req -new -sha256 -key cert.key -subj "/C=CN/CN=code-server" -out cert.csr openssl x509 -req -extfile <(cat /etc/pki/tls/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:code-server,IP:192.168.119.159")) -extensions SAN -CA ca.crt -CAkey ca.key -CAcreateserial -days 360 -in cert.csr -out cert.crt
- /etc/pki/tls/openssl.cnf: Replace it with the actual OpenSSL configuration file path.
- 192.168.119.159: Replace it with the actual code-server IP address.
- Generate the root certificate and private key.
- Download the code-server installation package, for example, code-server-4.96.2-linux-arm64.tar.gz.
1wget -O code-server-4.96.2-linux-arm64.tar.gz https://github.com/coder/code-server/releases/download/v4.96.2/code-server-4.96.2-linux-arm64.tar.gz
- Decompress the installation package.
1tar -zxf code-server-4.96.2-linux-arm64.tar.gz
- Go to the installation package directory.
1cd code-server-4.96.2-linux-arm64
- Install the Kunpeng DevKit plugin.
- Go to the Kunpeng DevKit Download Center and click IDE Plugin.
- In the VS Code (full installation package) area, click Download Package to download the DevKit plugin.
- Install the DevKit plugin on code-server. (Replace xxxxxx with the actual plugin name.)
./bin/code-server --install-extension xxxxxx.vsix
- Starting code-server requires glibc 2.25. Check your glibc version, and if it does not match, install the required version.
ldd --version
Exercise caution when upgrading or downgrading glibc. glibc is a core component of the system. If its version does not match, the system may fail to be started.
- Use the generated server certificate to start code-server.
./bin/code-server --auth=none --host 192.168.119.159 --port 8888 --cert /home/cert/cert.crt --cert-key /home/cert/cert.key &
- Change the example IP address and port to the actual server IP address and the port to be listened on, and replace the example certificate and private key with the private key and certificate location generated in 1. If you add the & parameter, code-server will be started in the background.
- After the installation is complete, you can use https://IP_adress:PORT to access the online IDE integrated with the DevKit.
Parent topic: Common Operations