How To Use Cockpit in Fedora 23

Several free options exist for remotely managing Linux servers through a graphical user interface. While some seek to replicate the full range of features available in paid control panels such as Plesk or cPanel, others are focused on helping you perform common tasks and manage essential services. The GUI for remote server administration that ships with Fedora 23, Cockpit, falls into the latter category.

Pre-Flight Check

  • This article is intended as an introduction to the Cockpit GUI on Fedora 23 Server edition.
  • We’ll be logging in as root to a Liquid Web Self-Managed Fedora 23 server.

Step #1: Enable Cockpit

Cockpit is included as part of the default installation of Fedora 23. It is not, however, automatically enabled. Fortunately, it’s easy to get it up and running:

  1. Starting Cockpit requires only a single command:

    systemctl start cockpit

    Note: The source image for some Fedora 23 servers, depending on when the server was created, may not have included Cockpit. If the above command returns an error, you can install it with: dnf -y install cockpit
  2. Now, we’ll configure it to start on boot with:

    systemctl enable cockpit.socket

    Running that command should produce output similar to the following:

    [root@host ~]# systemctl enable cockpit.socket
    Created symlink from /etc/systemd/system/sockets.target.wants/cockpit.socket to /usr/lib/systemd/system/cockpit.socket.

  3. You can check the status of Cockpit with:

    systemctl status cockpit

    Which should display status information similar to:

    [root@host ~]# systemctl status cockpit
    ● cockpit.service - Cockpit Web Service
    Loaded: loaded (/usr/lib/systemd/system/cockpit.service; static; vendor preset: disabled)
    Active: active (running) since Wed 2016-02-03 14:47:36 EST; 7s ago
    Docs: man:cockpit-ws(8)
    Process: 14713 ExecStartPre=/usr/sbin/remotectl certificate --ensure --user=root --group=cockpit-ws --selinux-type=etc_t (code=exited, status=0/SUCCESS)
    Main PID: 14717 (cockpit-ws)
    CGroup: /system.slice/cockpit.service
    └─14717 /usr/libexec/cockpit-ws
    Feb 03 14:47:36 host.example.com systemd[1]: Starting Cockpit Web Service...
    Feb 03 14:47:36 host.example.com systemd[1]: Started Cockpit Web Service.
    Feb 03 14:47:36 host.example.com cockpit-ws[14717]: Using certificate: /etc/cockpit/ws-certs.d/0-self-signed.cert

  4. Now that the service is running, we’ll need to make sure it’s accessible. Cockpit runs on port 9090, so you’ll need to allow it through the firewall. You can either add the service itself using:

    firewall-cmd --add-service=cockpit

    or simply open the port with:

    firewall-cmd --permanent --add-port=9090/tcp

  5. You now should reload the firewall for the rule to take effect:

    firewall-cmd --reload

Step #2: Log into Cockpit

  1. Point your browser to the Cockpit Dashboard at your server’s IP address and the Cockpit port, 9090:

    https://123.123.123.123:9090

    to arrive at Cockpit’s login screen.

    CockpitLoginScreen

  2. Use your server’s root credentials to log in.
  3. The server’s self-signed SSL certificate likely will trigger a browser warning, and you’ll need to accept the security certificate to proceed.
    Note: A self-signed certificate uses the same level of encryption as a verified certificate, except that it is you who are verifying your server’s identity, rather than a third party.

Step #3: Explore Cockpit

Once logged in you’ll see the Dashboard:

CockpitMainDashboard

The Dashboard loads the System tab by default, containing information about the server itself and graphs showing CPU and Memory Usage as well as Disk I/O and Network Traffic. Each chart label links to a more detailed view.

Cockpit’s main menu items allow you to perform a multitude of server management functions:

  • Services lists all services, and clicking on any entry takes you to a detail page showing the service log and allowing you to start/stop, enable/disable, reload/isolate, or mask/unmask each service.
  • Containers allows you to manage your Docker containers. You can search for new containers, add or remove containers, start and stop them, and set runtime variables on this page.
  • Logs displays the server’s system and service logs, and allows you to click on any entry for more detailed information, such as the process ID.
  • Storage gives you a graphical look at disk reads and writes, and also allows you to view relevant logs. In addition, you can set up and manage RAID devices and volume groups, and format, partition, and mount/unmount drives.
  • Networking contains an overview of inbound and outbound traffic, along with relevant logs and network interface information. You also can configure the network interface from this page.
  • The Tools menu expands to offer two additional user and server management tools:
    • Accounts lets you add and manage users, set up and change passwords, and add and manage public SSH keys for each user.
    • Terminal contains a fully functional terminal, with tab completion, allowing you to perform any task you could perform through its web interface with the same privileges your login credentials would allow via SSH.

Step #4: Learn More about Cockpit

Check out Cockpit’s official documentation to explore its features and learn how you can integrate Cockpit into your server management workflow.
 

How To Install NVM (Node Version Manager) on Fedora 23

Node Version Manager allows you to quickly install and manage node.js versions. It’s a bash script that has the capability to manage multiple active versions of node.js. It can be used to install node.js versions, execute commands with a specific node.js version, set the PATH variable to use a specific node.js version, and more. To learn more, visit the project’s Github page.

Pre-Flight Check

  • These instructions are intended specifically for installing NVM (Node Version Manager) on Fedora 23. To install NVM on another operating system, follow our guides for Fedora 21, CentOS 7 and Ubuntu 14.04 LTS. To install Node.js via NVM on Fedora 23, refer to our Knowledge Base article.
  • We’ll be logging in as root to a Liquid Web Self Managed Fedora 23 server.

Step #1: Install NVM (Node Version Manager)

Install the script with the following command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

After running the above command, you may be instructed to close and re-open your terminal to begin using NVM. However, you also can begin using NVM immediately by running the following command:

source ~/.bashrc

Step #2: Verify the Installation

The following command will verify the installation by returning the currently installed version:

nvm --version

In this case, that yields the following output:

[root@host ~]# nvm --version
0.30.2

 

How To Install Node.js on Fedora 23

Node.js is a cross-platform runtime environment built on JavaScript. Applications also are written in JavaScript. Node.js lends itself to rapidly deploying, real-time web applications, and is considered extremely scalable due to its event-driven architecture. Node Version Manager allows admins to easily install and manage multiple node.js versions.

Pre-Flight Check

  • These instructions are intended specifically for installing Node.js via NVM (Node Version Manager) on Fedora 23. To install Node.js on another operating system, follow our guides for Fedora 21, CentOS 7, and Ubuntu 14.04 LTS.
  • We’ll be working as root on a Liquid Web Self Managed Fedora 23 server.

Step #1: Install NVM (Node Version Manager)

If NVM is not already installed, you’ll first want to follow our tutorial on How to Install NVM (Node Version Manager) for Node.js on Fedora 23 before proceeding.

Step #2: Check Available Node.js Versions

To view a list of the versions that are available for installation, run this command:

nvm ls-remote

In addition to selecting a specific version from the output of that command, you also can simply install the latest stable or unstable versions, as shown in the next step.

Step #3: Install a Node.js Version

  1. To download, compile, and install the latest version in the v0.12.x release of node.js, run this command:

    nvm install 0.12

  2. Now, to display currently activated version run:

    nvm current

    Which results in the following output:

    [root@host ~]# nvm current
    v0.12.9

    In this case, the server is running v0.12.9.

  3. To download, compile, and install the latest stable release of node.js, simply run:

    nvm install stable

  4. To show the currently activated version, run:

    nvm current

    In this case, that command returns the following output:

    [root@host ~]# nvm current
    v5.7.0

  5. You can list the currently installed node versions with the command:

    nvm ls

    which, in this case, produces the following output:

    [root@host ~]# nvm ls
    v0.12.9
    -> v5.7.0
    node -> stable (-> v5.7.0) (default)
    stable -> 5.7 (-> v5.7.0) (default)
    iojs -> N/A (default)

  6. Finally, if you want to modify PATH to use v0.12.9 again, you can use the following command:

    nvm use 0.12.9

    Which returns:

    [root@host ~]# nvm use 0.12.9
    Now using node v0.12.9 (npm v2.14.9)

 

How To Install Varnish on Fedora 23

Varnish is a web accelerator, specifically a caching HTTP reverse proxy, designed to improve performance for busy, dynamic websites. By redirecting traffic to static pages whenever possible, Varnish reduces the number of dynamic page calls, thus reducing load.

Pre-Flight Check

  • These instructions are intended specifically for installing varnish on Fedora 23. If you’re using a different operating system, check out our guides to installing varnish on Fedora 21 or CentOS 7.
  • We’ll be working as root on a Liquid Web Self Managed Fedora 23 server. Apache and PHP already are installed, configured, and running.

Step #1: Install Varnish

A single command installs Varnish:

dnf -y install varnish

Step #2: Start Varnish

To configure varnish to start at boot, run the following command:

systemctl enable varnish

That should return output similar to:

[root@host ~]# systemctl enable varnish
Created symlink from /etc/systemd/system/multi-user.target.wants/varnish.service to /usr/lib/systemd/system/varnish.service.

To start Varnish:

systemctl start varnish

To check the status of Varnish:

systemctl status varnish

Varnish is configured to listen on port 6081 by default. It expects your web server to be listening on port 8080.

Step #3: Configuration File Locations

A basic and default configuration file can be found at:

/etc/varnish/default.vcl

An example configuration can be found in:

/usr/share/doc/varnish/example.vcl
 

How To Install XCache on Fedora 23

Pre-Flight Check

Step #1: Install XCache

As a matter of best practice we’ll update our packages with:

sudo dnf -y update

Now we’ll install XCache and any required packages with the following command:

sudo dnf -y install php-xcache xcache-admin

Step #2: Verify the Extension is Available

You can verify that the extension is available with the following command:

php -m | grep XCache

That will output results similar to:

[root@host ~]# php -m | grep XCache
XCache
XCache Cacher
XCache Coverager
XCache Optimizer

Listing the PHP version with “php -v” should now also include information about XCache:

[root@host ~]# php -v
PHP 5.6.19 (cli) (built: Nov 26 2015 08:32:41)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with XCache v3.2.0, Copyright (c) 2005-2014, by mOo
with XCache Optimizer v3.2.0, Copyright (c) 2005-2014, by mOo
with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
with XCache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo

 

How To Install Memcached on Fedora 23

Memcached is a high-performance distributed, in-memory caching system. It primarily is used to speed up sites that make heavy use of databases. It also can, however, be used to store any kind of object.

Most popular Content Management Systems have a plugin or module designed to take advantage of memcached, and many programming languages such as PHP, Perl, Python, and Ruby also have a memcached library.

Memcached runs in memory and is quite fast, as it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing Memcached on a single Fedora 23 node. If you’re using a different operating system, check out our guides to installing Memcached on Ubuntu 15.04, CentOS 6 and CentOS 7.
  • We’ll be working as root on a Liquid Web Self Managed Fedora 23 server.

Step #1: Install Memcached

First, we’ll clean up our package files:

dnf clean all

As a matter of best practice we’ll now update our packages:

dnf -y update

To install Memcached and related packages, run the command:

dnf -y install memcached

Step #2: Configure Memcached

Use the following command to view information on the memcached command:

memcached -h

The default configuration file is located at /etc/sysconfig/memcached. Open that file to view the configuration:

vim /etc/sysconfig/memcached

In vim, remember that you can press “a” to enter text insertion mode; pressing the escape key (Esc) on your keyboard returns you to command mode. For a refresher on editing files with vim, see New User Tutorial: Overview of the Vim Text Editor. If vim is not installed on your OS, you can follow our tutorial on installing vim at How to Install VIM (Visual editor IMproved) on Fedora 23.

The contents of the file should appear similar to this:

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

  • PORT is the port on which memcached will run. By default it is 11211.
  • USER is the user as which memcached runs.
  • MAXCONN is the maximum number of connections to memcached.
  • CACHESIZE is the size of the cache, in MB.
  • OPTIONS contains any additional specified options. In this case, there are none.

If you would like to change the port (PORT), the user Memcached runs as (USER), the maximum number of allowed connections to Memcached (MAXCONN), or the cache size in megabytes (CACHESIZE), simply change the options in the configuration file.

After making any changes, save and exit the configuration file with :wq and then restart Memcached:

systemctl restart memcached

Step #3: Configure Memcached to Start on Boot

The following code will ensure that Memcached starts at boot:

systemctl enable memcached

That will produce output similar to:

[root@host ~]# systemctl enable memcached
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.

To check the status of Memcached:

systemctl status memcached

To stop Memcached:

systemctl stop memcached

To start Memcached:

systemctl start memcached

Step #4: Install the Memcached PHP Extension

If needed, install the Memcached PHP extension with the following command:

dnf -y install php-pecl-memcache

Now restart memcached and Apache for the settings to take effect:

systemctl restart memcached
systemctl restart httpd

To verify that the PHP module is loaded, run the command:

php -m | grep memcache

That should produce output similar to:

[root@host ~]# php -m | grep memcache
memcache

And finally, you can check the php.ini to confirm your Memcached settings:

php -i | grep memcache

That should produce output similar to:

[root@host ~]# php -i | grep memcache
/etc/php.d/40-memcache.ini,
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2
Registered save handlers => files user memcache

 

How To Install Squid on Fedora 23

Squid is a caching and forwarding web proxy. It is most often used in conjunction with a traditional LAMP stack (Linux, Apache, MySQL, PHP), and can be used to filter traffic on HTTP, FTP, and HTTPS, and increase the speed (thus lower the response time) for a web server via caching.

Pre-Flight Check

  • These instructions are intended specifically for installing Squid on a single Fedora 23 node. If you’re using a different operating system, check out our guides to installing Squid on Fedora 21, Ubuntu 14.04, and CentOS 7.
  • We’ll be logging in as root to a Liquid Web Self Managed Fedora 23 server.

Step #1 Install Squid

As a matter of best practice we’ll first update our packages:

dnf -y update

Now we’ll install Squid and related packages with:

dnf -y install squid

Step #2: Verify the Squid Installation

Use the following command to view information about the ‘squid’ command:

squid -h

Use the following command to check the version number of Squid and the configuration options it was started with:

squid -v

Your results should appear similar to:

Squid Cache: Version 3.5.9
Service Name: squid
configure options: '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--exec_prefix=/usr' '--libexecdir=/usr/lib64/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--sysconfdir=/etc/squid' '--with-logdir=/var/log/squid' '--with-pidfile=/var/run/squid.pid' '--disable-dependency-tracking' '--enable-eui' '--enable-follow-x-forwarded-for' '--enable-auth' '--enable-auth-basic=DB,LDAP,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB,getpwnam' '--enable-auth-ntlm=smb_lm,fake' '--enable-auth-digest=file,LDAP' '--enable-auth-negotiate=kerberos' '--enable-external-acl-helpers=LDAP_group,time_quota,session,unix_group,wbinfo_group' '--enable-storeid-rewrite-helpers=file' '--enable-cache-digests' '--enable-cachemgr-hostname=localhost' '--enable-delay-pools' '--enable-epoll' '--enable-icap-client' '--enable-ident-lookups' '--enable-linux-netfilter' '--enable-removal-policies=heap,lru' '--enable-snmp' '--enable-ssl' '--enable-ssl-crtd' '--enable-storeio=aufs,diskd,ufs,rock' '--enable-diskio' '--enable-wccpv2' '--enable-esi' '--enable-ecap' '--with-aio' '--with-default-user=squid' '--with-dl' '--with-openssl' '--with-pthreads' '--disable-arch-native' '--with-pic' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC' 'LDFLAGS=-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -pie -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel' 'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Step #3: Start Squid and Configure it To Start on Boot

To start Squid:

systemctl start squid

Set Squid to start at boot:

systemctl enable squid

To check the status of Squid:

systemctl status squid

To stop Squid:

systemctl stop squid
 

How To Install and Connect to PostgreSQL on Fedora 23

PostgreSQL is a free, open-source object-relational database management system (object-RDBMS), similar to MySQL, and is standards-compliant and extensible. It often is used as a back-end for web and mobile applications. PostgreSQL, or ‘Postgres’ as it is nicknamed, adopts the ANSI/ISO SQL standards together, with the revisions.

Pre-Flight Check

Step #1: Add the PostgreSQL 9.4 Repository

In this case we want to install PostgreSQL 9.4.4 directly from the Postgres repository. First, we’ll add the repo:

rpm -iUvh http://yum.postgresql.org/9.4/fedora/fedora-23-x86_64/pgdg-fedora94-9.4-4.noarch.rpm

Step #2: Install PostgreSQL

First, we’ll observe best practices by ensuring that the list of available packages is up to date:

dnf -y update

Then it’s a matter of running one command for installation:

dnf -y install postgresql94 postgresql94-server postgresql94-contrib postgresql94-libs --enablerepo=pgdg94

PostgreSQL now should be installed.

Step #3: Start PostgreSQL

Configure Postgres to start when the server boots:
systemctl enable postgresql-9.4

That should produce output similar to the following:

[root@host ~]# systemctl enable postgresql-9.4
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-9.4.service to /usr/lib/systemd/system/postgresql-9.4.service.

Initialize Postgres with the following command:

/usr/pgsql-9.4/bin/postgresql94-setup initdb

Which should result in:

/usr/pgsql-9.4/bin/postgresql94-setup initdb
Initializing database ... OK

Then start Postgres:

systemctl start postgresql-9.4

Step #4: Switch to the Default PostgreSQL User

As part of the installation, Postgres adds the system user “postgres” and is setup to use “ident” authentication. Roles internal to Postgres (which are similar to users) match with a system user account.

Let’s switch into that system user:

su - postgres

You’ll receive a command line similar to:

-bash-4.3$

And then connect to the PostgreSQL terminal (in the postgres role):

psql

To quit psql, type:

\q

and to return to the previous user, type:
exit
 

How To Install Pip on Fedora 23

Pip is a tool for installing and managing packages for Python. The popular Python programming language is considered one of the easiest to learn because of its emphasis on code readability.

Pre-Flight Check

  • These instructions are intended specifically for installing Pip on Fedora 23. If you’re using a different operating system, check out our guides to installing pip on Fedora 21 and CentOS 7.
  • We’ll be working from a Liquid Web Self Managed Fedora 23 server and logging in as root.

Step #1: Install Pip

First, we’ll clean up our packages:

dnf clean all

As a matter of best practice we’ll now also update our packages:

dnf -y update

Now we’ll install python-pip and any required packages:

dnf -y install python-pip

Step #2: Verify the Installation

View a list of helpful commands:

pip --help

Check the version of Pip that is installed:

pip -V

Which should yield a result similar to:

pip 7.1.0 from /usr/lib/python2.7/site-packages (python 2.7)
 

How To Install mlocate (locate and updatedb) on Fedora 23

The locate command is an invaluable tool when you’re trying to track down a particular file but know only the file name. Locate reads one or more databases prepared by the related updatedb and writes file names matching at least one of the patterns to standard output, one per line.

Pre-Flight Check

Step #1: Install mlocate

We’ll first update our packages:

dnf -y update

Then we’ll install mlocate and any required packages:

dnf -y install mlocate

Step #2: Updating mlocate

Upon installation, mlocate installs a systemd timer to regularly update the search database. However, you can manually trigger an update of the search databases with:

updatedb