It's simple.
Install
First:
sudo apt install cockpit -y
Authentication
Ensure you have a user instead of root
is in the sudo
group.
Please follow the instructions from: Best practice for authentication
Fix network issue
You may see the following error after installation:
packagekit cannot refresh cache whilst offline
First go to here:
cd /etc/netplan/
Create a new profile:
sudo touch /etc/netplan/49-set-nm-renderer-for-cockpit.yaml
Edit it as content:
sudo vim /etc/netplan/49-set-nm-renderer-for-cockpit.yaml
network:
version: 2
renderer: NetworkManager
Move other profiles to bigger number. For exmaple, move ./00-installer-config.yaml
to ./50-installer-config.yaml
.
sudo mv ./00-installer-config.yaml ./50-installer-config.yaml
Apply net plan:
sudo netplan apply
Restart related services:
sudo systemctl restart cockpit
Install navigator plugin
sudo apt install -y jq
latestUrl=$(curl https://api.github.com/repos/45Drives/cockpit-navigator/releases/latest | jq -r '(.assets[] | select(.browser_download_url | contains(".deb"))).browser_download_url')
echo "Latest download url is $latestUrl"
wget -O /home/anduin/install.deb $latestUrl
sudo dpkg -i /home/anduin/install.deb
rm /home/anduin/install.deb
Try cockpit on your browser!
Open browser, open: https://host:9090
. Ignore cert issues.
Ensure HTTPS
By the way, you may need Caddy to reverse proxy the cockpit server.
Install caddy:
cat /etc/apt/sources.list.d/caddy-fury.list | grep -q caddy || echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install -y caddy
You can follow practice here: Caddy Tips
Example:
# Manual 2FA.
jump.aiursoft.cn {
basicauth / {
anduin $2a$12$HHHHHHHHAAAAASSSSSSSSHHHHHHHHH
}
reverse_proxy https://jump:9090 {
transport http {
tls_insecure_skip_verify
}
}
}
I appreciate your detailed guide on installing Cockpit on Ubuntu 22.04. The step-by-step instructions you provided, along with the code snippets, make it easy for readers to follow and implement the process. The inclusion of images and links to external resources for further reading is also helpful.
One of the highlights of your blog post is the section on fixing the network issue. It's beneficial for users who may encounter the "packagekit cannot refresh cache whilst offline" error. The instructions on creating a new profile and applying the net plan are clear and concise.
However, there are a few areas where your post could be improved. First, it would be helpful to provide a brief introduction to Cockpit and its features, as well as why someone might want to install it on Ubuntu 22.04. This would give readers a better understanding of the software and its benefits.
Second, although you provide a clear example of using Caddy to reverse proxy the Cockpit server, it might be useful to explain why this step is necessary and how it improves the security of the setup. This would help readers understand the importance of ensuring HTTPS for their Cockpit installation.
Lastly, it's essential to proofread your post to fix minor grammatical errors and improve readability. For example, in the sentence "Ensure you have a user instead of
root
is in thesudo
group," consider rephrasing it to "Ensure you have a user, instead ofroot
, in thesudo
group."Overall, your blog post is informative and provides a valuable resource for users looking to install Cockpit on Ubuntu 22.04. With some minor improvements, it could be even more helpful and engaging for readers. Keep up the great work!