<\/span><\/h2>\nCockpit is included in the Debian 9 ‘backports’ repositories, therefore it can be easily installed using the apt package manager. In order to do that, we have to enable the Debian ‘backports’ repository:<\/p>\n
echo 'deb http:\/\/deb.debian.org\/debian stretch-backports main' > \\\r\n \/etc\/apt\/sources.list.d\/backports.list<\/pre>\nOnce it is enabled, update the repository list:<\/p>\n
apt update<\/pre>\nOnce the repository list is updated, run the following command to install Cockpit along with all of its dependencies:<\/p>\n
apt -y install cockpit<\/pre>\nEnable the Cockpit service to automatically start after a server reboot:<\/p>\n
systemctl enable cockpit<\/pre>\nAfter the installation is completed, Cockpit should be automatically started. You can check its status by issuing the following command:<\/p>\n
systemctl status cockpit<\/pre>\nOutput:<\/p>\n
cockpit.service - Cockpit Web Service\r\n Loaded: loaded (\/lib\/systemd\/system\/cockpit.service; static; vendor preset: enabled)\r\n Active: active (running) since Tue 2019-07-02 05:44:29 EDT; 2min 33s ago\r\n Docs: man:cockpit-ws(8)\r\n Process: 9737 ExecStartPre=\/usr\/sbin\/remotectl certificate --ensure --user=root --group=cockpit-ws --selinux-type= (code=exited, status=0\/SUCCESS)\r\n Main PID: 9740 (cockpit-ws)\r\n Tasks: 3 (limit: 4915)\r\n CGroup: \/system.slice\/cockpit.service\r\n \u00e2\u00e29740 \/usr\/lib\/cockpit\/cockpit-ws\r\n \u00e2\u00e29746 \/usr\/bin\/ssh-agent\r\n\r\nJul 02 05:44:30 hostname cockpit-ws[9740]: logged in user session<\/pre>\nThe status output shows that Cockpit is up and running on your Debian 9 VPS and you can already start using it. Cockpit by default is listening on port 9090 and at this point you can access it by navigating your favorite web browser to http:\/\/Your_IP\/9090<\/code> . However, you might not have a web server installed, so we’ll be showing you how to do that in the next step. On top of that, we will also show you how to configure the web server, so you can access Cockpit with a domain name instead of your server’s IP address.<\/p>\n<\/span>Step 3: Install and Configure Apache as a Reverse Proxy<\/strong><\/span><\/h2>\nApache is the most popular web server in the world. We will install it for the purposes of this tutorial and use it as a reverse proxy. If Apache is not already installed on your Debian 9 VPS, you can easily install it using the following command:<\/p>\n
apt -y install apache2<\/pre>\nAfter the installation has been completed, the web server should be automatically started and running on your server. Check its status to make sure that it’s running:<\/p>\n
systemctl status apache2<\/pre>\nOutput:<\/p>\n
apache2.service - The Apache HTTP Server\r\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset:\r\n Drop-In: \/lib\/systemd\/system\/apache2.service.d\r\n \u2514\u2500apache2-systemd.conf\r\n Active: active (running) since Thu 2019-07-04 05:02:57 CDT; 4h 35min ago\r\n Process: 1766 ExecReload=\/usr\/sbin\/apachectl graceful (code=exited, status=0\/S\r\n Process: 692 ExecStart=\/usr\/sbin\/apachectl start (code=exited, status=0\/SUCCES\r\n Main PID: 790 (apache2)\r\n Tasks: 8 (limit: 1112)\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u2500 790 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 1865 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 1866 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 1867 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 1871 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500 1872 \/usr\/sbin\/apache2 -k start\r\n \u251c\u250013591 \/usr\/sbin\/apache2 -k start\r\n \u2514\u250013662 \/usr\/sbin\/apache2 -k start\r\n<\/pre>\nMake sure to enable the Apache web server to automatically start after a server reboot:<\/p>\n
systemctl enable apache2<\/pre>\nNext, we will create an Apache virtual host for the domain name which we will use to access Cockpit. For our example, we will use domain.com<\/code>, so make sure to change all instances of that domain name to your unique domain name. Create an Apache configuration file with the following contents:<\/p>\nnano \/etc\/apache2\/sites-available\/domain.com<\/span>.conf\r\n\r\n<VirtualHost *:80>\r\nServerName domain.com<\/span>\r\nServerAlias www.domain.com<\/span>\r\n\r\nProxyRequests Off\r\n\r\nOrder deny,allow\r\nAllow from all\r\n\r\n\r\nRewriteEngine On\r\nRewriteCond %{HTTP:Upgrade} =websocket [NC]\r\nRewriteRule \/(.*) ws:\/\/127.0.0.1:9090\/$1 [P,L]\r\nRewriteCond %{HTTP:Upgrade} !=websocket [NC]\r\nRewriteRule \/(.*) http:\/\/127.0.0.1:9090\/$1 [P,L]\r\n\r\nProxyPass \/ http:\/\/127.0.0.1:9090\/\r\nProxyPassReverse \/ http:\/\/127.0.0.1:9090\/\r\n\r\nOrder allow,deny\r\nAllow from all\r\n<\/VirtualHost><\/pre>\nSave the file and activate the virtual host with the following command:<\/p>\n
a2ensite domain.com<\/span><\/pre>\nAnd then restart the web server for the changes to take effect:<\/p>\n
systemctl restart apache2<\/pre>\nFinally, you should be able to access Cockpit with your domain name at http:\/\/domain.com<\/span> and use one of your system users to log into the application.<\/p>\n <\/p>\n
That’s it! You now have a working setup of Cockpit on your Debian 9 VPS.<\/p>\n
\n Of course, you don\u2019t have to install Cockpit on Debian 9, if you use one of our Managed Debian Hosting<\/a> solutions, in which case you can simply ask our expert Linux admins to setup Cockpit on Debian 9 for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\nPS.<\/strong><\/span> If you liked this post on how to install Cockpit on a Debian 9 VPS, please share it with your friends on the social networks using the share buttons below, or simply leave a comment down in the comments section. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"In this tutorial, we will guide you through the steps of installing Cockpit on a Debian 9 VPS as well … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":31449,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1700,13],"tags":[1299,48],"yoast_head":"\nInstall Cockpit on Debian 9 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n