Code Server - Install on Ubuntu Server
Steps to Install Code Server on Ubuntu Server
1. Update Your System
First, ensure your system is up-to-date:
sudo apt update sudo apt upgrade
2. Download the Latest Code Server Release
Go to the Code Server GitHub releases page and get the download link for the latest version. Alternatively, you can download it via the terminal. Here's how:
curl -fsSL https://code-server.dev/install.sh | sh
This script will automatically download and install Code Server on your Ubuntu server.
3. Start Code Server
Once Code Server is installed, you can start it with the following command:
code-server
The output will include an address like http://127.0.0.1:8080/
and a password you can use to log in.
4. Configure Code Server (Optional)
You might want to configure Code Server to run in the background, change the port, or disable the password for easier access.
To configure Code Server:
-
Open the configuration file:
sudo nano ~/.config/code-server/config.yaml
-
Modify settings such as
bind-addr
,auth
, orpassword
to suit your needs.
Example:
bind-addr: 0.0.0.0:8080 auth: password password: "your_password_here" cert: false
bind-addr
: Sets the IP and port to listen on. Using0.0.0.0
allows access from any IP address.auth
: Can be set topassword
(default) ornone
.password
: You can specify your own password here.cert
: Set tofalse
if you are not using SSL.
5. Run Code Server in the Background
To run Code Server in the background or on startup, you can create a systemd service:
-
Create a service file:
sudo nano /lib/systemd/system/code-server.service
-
Add the following configuration to the file:
[Unit] Description=Code Server After=network.target [Service] Type=simple User=andresz # Change to your user ExecStart=/usr/bin/code-server --bind-addr 0.0.0.0:8080 Restart=always [Install] WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl enable code-server sudo systemctl start code-server
6. Access Code Server
- Open your browser and go to
http://your-server-ip:8080
. - Use the password provided earlier (or the one you set in
config.yaml
).
7. Optional: Setup SSL
If you want to serve Code Server over HTTPS, you can use a reverse proxy like Nginx with an SSL certificate from Let's Encrypt.
Let me know if you need help setting up HTTPS or anything else!