{"id":5159,"date":"2020-07-16T20:18:27","date_gmt":"2020-07-16T14:48:27","guid":{"rendered":"https:\/\/www.skynats.com\/?p=5159"},"modified":"2025-04-10T12:12:17","modified_gmt":"2025-04-10T06:42:17","slug":"install-cockpit-server-manager-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/install-cockpit-server-manager-on-ubuntu-18-04\/","title":{"rendered":"How to Install Cockpit server manager on Ubuntu 18.04"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Cockpit is a server manager that helps the system admins to access the GNU\/Linux servers via web browser. This software helps to access the server logs and to start and stop the services, see resource usage via a graphical interface. Here you will learn how to install Cockpit on Ubuntu with our easy guide<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using the Cockpit, we can monitor the server activities and add several servers. It is not only a monitoring tool; it also allows us to do everything on the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Login and update all Server OS packages<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nssh root@<span style=\"color:#9c0103\" class=\"has-inline-color\">IP_Address<\/span> -p <span style=\"color:#a60103\" class=\"has-inline-color\">Port_number<\/span><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216;<span style=\"color:#a80306\" class=\"has-inline-color\"><kbd>IP_Address<\/kbd><\/span><span class=\"has-inline-color has-primary-color\">&#8216; and &#8216;<\/span><span style=\"color:#a80306\" class=\"has-inline-color\"><kbd>Port_number<\/kbd><\/span>&#8216; must be replaced by your IP and SSH port number of the respective servers (if using a custom port number). In addition, if necessary, replace &#8220;root&#8221; for the username of the admin account. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We must be sure that all <a href=\"https:\/\/ubuntu.com\/\" target=\"_blank\" rel=\"noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-secondary-color\">Ubuntu<\/mark><\/a> OS-required packages that have been installed on the server are up to date before starting the Cockpit installation. By using the following commands, we can do this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\nsudo apt-get upgrade<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Install Cockpit<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To install the latest version of Cockpit, run the following command in the official repositories of Ubuntu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n<p>sudo apt-get install cockpit<\/p><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We need to install a web server, an SSL certificate on that domain, and configure Cockpit behind a reverse proxy in order to access Cockpit solely using your domain name, e.g.<span class=\"has-inline-color has-accent-color\"><kbd>https:\/\/your-domain.com<\/kbd><\/span>, without the port number 9090 within the URL. Don&#8217;t worry, we&#8217;ll go over those stages as well in this guide.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Install Apache<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check whether Apache is installed and running on the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg -l | grep -i apache2\nps aux | grep apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If not installed, use the following Apache Web Server installation command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable Apache service to start on server boot automatically with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The following command can also be used to check the status of the Apache service. It should already be up and running, but let&#8217;s double-check:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is how the output should appear:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apache2.service \u2013 The Apache HTTP Server\nLoaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\nDrop-In: \/lib\/systemd\/system\/apache2.service.d\n\u2514\u2500apache2-systemd.conf\nActive: active (running) since Sun 2019-06-30 11:12:05 CDT; 9min ago\nMain PID: 9277 (apache2)\nTasks: 7 (limit: 2321)\nCGroup: \/system.slice\/apache2.service\n\u251c\u2500 9277 \/usr\/sbin\/apache2 -k start\n\u251c\u2500 9280 \/usr\/sbin\/apache2 -k start\n\u251c\u2500 9281 \/usr\/sbin\/apache2 -k start\n\u251c\u2500 9282 \/usr\/sbin\/apache2 -k start\n\u251c\u2500 9283 \/usr\/sbin\/apache2 -k start\n\u251c\u2500 9284 \/usr\/sbin\/apache2 -k start\n\u2514\u250022386 \/usr\/sbin\/apache2 -k start\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 4<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Install a Let\u2019s Encrypt SSL certificate<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install Certbot, a programme that automates the installation of SSL\/TLS certificates using Let&#8217;s Encrypt Free SSL. This provides free security for your website. Run the following command to install the Let&#8217;s Encrypt packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install certbot python-certbot-apache<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On your domain, install Let&#8217;s Encrypt SSL certificate. Certbot configures the Apache configuration to use SSL automatically:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot --apache -d your-domain.com -d www.your-domain.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter a genuine email address because that is where information regarding your certificate status (for example, an expiring certificate) will arrive. During installation, select the option to redirect HTTP traffic to HTTPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 5<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Configure an Reverse Proxy in Apache<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now in Apache we can set a reverse proxy. To do this, some additional proxy modules must be enabled in Apache. Execute the commands below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2enmod proxy\na2enmod proxy_http\na2enmod proxy_wstunnel<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To apply the modifications, restart Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create a new configuration file for your domain with the following command once <span class=\"has-inline-color has-accent-color\"><kbd>mod_proxy<\/kbd><\/span><span class=\"has-inline-color has-primary-color\">, <\/span><span class=\"has-inline-color has-accent-color\"><kbd>mod_proxy<\/kbd><\/span> http, and <span class=\"has-inline-color has-accent-color\"><kbd>proxy_wstunnel<\/kbd><\/span> have been enabled in Apache:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NOTE: It&#8217;s important that you replace \u201c<span class=\"has-inline-color has-accent-color\"><kbd>your-domain.com<\/kbd><\/span>\u201d in<strong> ALL <\/strong>places where it appears in the config file and elsewhere. Your settings may not work if you don&#8217;t.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/apache2\/sites-available\/your-domain.com.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And then enter the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n\nServerName your-domain.com\nServerAlias www.your-domain.com\n\nRewriteEngine on\nRewriteCond %{SERVER_NAME} =www.your-domain.com &#91;OR]\nRewriteCond %{SERVER_NAME} =your-domain.com\nRewriteRule ^ https:\/\/%{SERVER_NAME}%{REQUEST_URI} &#91;END,NE,R=permanent]\n&lt;\/VirtualHost&gt;\n\n&lt;IfModule mod_ssl.c&gt;\n\n&lt;VirtualHost *:443&gt;\n\nServerName your-domain.com\nServerAlias www.your-domain.com\n\nProxyRequests Off\n&lt;Proxy *&gt;\nOrder deny,allow\nAllow from all\n&lt;\/Proxy&gt;\n\nRewriteEngine On\nRewriteCond %{HTTP:Upgrade} =websocket &#91;NC]\nRewriteRule \/(.*) ws:\/\/127.0.0.1:9090\/$1 &#91;P,L]\nRewriteCond %{HTTP:Upgrade} !=websocket &#91;NC]\nRewriteRule \/(.*) http:\/\/127.0.0.1:9090\/$1 &#91;P,L]\n\nProxyPass \/ http:\/\/127.0.0.1:9090\/\nProxyPassReverse \/ http:\/\/127.0.0.1:9090\/\n&lt;Location \/&gt;\nOrder allow,deny\nAllow from all\n&lt;\/Location&gt;\n\nSSLCertificateFile \/etc\/letsencrypt\/live\/your-domain.com\/fullchain.pem\nSSLCertificateKeyFile \/etc\/letsencrypt\/live\/your-domain.com\/privkey.pem\nInclude \/etc\/letsencrypt\/options-ssl-apache.conf\n\n&lt;\/VirtualHost&gt;\n\n&lt;\/IfModule&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Remember to change the domain name of your &#8216;<span style=\"color:#a00003\" class=\"has-inline-color\">your-domain.com<\/span>&#8216; Save the file, close it down, and disable the default Apache setup:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2dissite 000-default<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In Apache, enable the configuration &#8220;<span style=\"color:#a4020a\" class=\"has-inline-color\">your-domain.com.<\/span>conf&#8221; with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2ensite <span style=\"color:#a40406\" class=\"has-inline-color\">your-domain.com<\/span><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To enable it, we will use the subsequent command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/etc\/apache2\/sites-available\/<span style=\"color:#9d0205\" class=\"has-inline-color\">your-domain.com<\/span>.conf \/etc\/apache2\/sites-enabled\/<span style=\"color:#a30306\" class=\"has-inline-color\">your-domain.com<\/span>.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then, in order for the modifications to take effect, restart Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following lines to the Cockpit configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;WebService]\nOrigins = https:\/\/your-domain.com http:\/\/127.0.0.1:9090\nProtocolHeader = X-Forwarded-Proto\nAllowUnencrypted = true<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart Cockpit and set it to start when the server boots:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart cockpit.socket\nsudo systemctl enable cockpit.socket<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We can now visit Cockpit without having to utilise port 9090 in a web browser \u2013 instead, we may use <span class=\"has-inline-color has-accent-color\"><kbd>https\/\/your-domain.com<\/kbd><\/span>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Login as root or use the server&#8217;s existing system user account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can create it with this command if there are currently no user accounts created on the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>adduser username<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the <span class=\"has-inline-color has-accent-color\"><kbd>username<\/kbd><\/span><sup> <\/sup>with the actual new user account name and the new user account password will be set and confirmed. Make sure you use a strong new account password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now you have an installation of Cockpit working on your server Ubuntu 18.04.<\/p>\n\n\n\n<figure class=\"wp-block-pullquote is-style-default\"><blockquote><p><strong>Do you want our expert team to install Cockpit?<\/strong><\/p><cite><strong><a href=\"https:\/\/www.skynats.com\/contact-us\/\" target=\"_blank\" rel=\"noreferrer noopener\">CONTACT US NOW<\/a><\/strong><\/cite><\/blockquote><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Cockpit is a server manager that helps the system admins to access the GNU\/Linux servers via web browser. This software helps to access the server logs and to start and stop the services, see resource usage via a graphical interface. Here you will learn how to install Cockpit on Ubuntu with our easy guide By [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[74,75],"class_list":["post-5159","post","type-post","status-publish","format-standard","hentry","category-blog","tag-cockpit-in-ubuntu","tag-cockpit-server-manager"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/5159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=5159"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/5159\/revisions"}],"predecessor-version":[{"id":14708,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/5159\/revisions\/14708"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=5159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=5159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=5159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}