How To Install The Caddy Web Server On Linux

These days, HTTPS is key when hosting a website. Without it, your users could be leaking very personal data from your website into the world. To solve this, many Linux webmasters have taken to using the LetsEncrypt tools, as they make it very easy to generate a certificate. Still, for as easy as LetsEncrpyt is, enabling it on Nginx or Apache on Linux can still be a bit of a chore. Luckily, there’s a better way. Introducing the Caddy web server. It’s web server that has HTTPS enabled by default. If you’re sick of hassling with SSL certificates, Caddy may be just what you need.

Installing Caddy

Installing the Caddy web server works pretty much the same no matter what server operating system you are using. The reason Caddy is so easy to install is that of the developer’s choice to use a downloadable Bash script for installing the software, rather than adding third-party software repositories or installing via binaries.

In this tutorial, we’ll be using Ubuntu Server, though running the Caddy web Server will work just fine on most other Linux OS’s too, even desktop ones. To start off, make sure you have the Curl app on your Linux PC. If you don’t, open up a terminal search your package manager for “curl”, and install it.

Note: determine if you have curl already by running curl in the terminal. If the “help” dialog shows up for the program, you have Curl on your Linux machine.

curl https://getcaddy.com | bash -s personal

The Caddy web server is free to use for personal use, but you must specify it. Planning to use Caddy in an enterprise setting? Run the installation command with:

curl https://getcaddy.com | bash -s commercial

Running Curl will pipe it through Bash and automatically start the installation process. The Caddy installer will take time to download the web server binary and place it in /usr/local/bin/ directory. If the installation is successful, you’ll see a message saying “Successfully Installed”.

At this point, you’ll need to modify the Caddy binary. Run the following command in the terminal, with sudo privileges.

sudo setcap cap_net_bind_service=+ep /usr/local/bin/caddy

Configuring Caddy

Caddy is installed on the server. The next step in the process is to configure the directory structure. Start out by getting a root terminal. Doing this will make modifying folders in the file system much faster, as you won’t need to enter sudo for every command, followed by a password.

On most systems, users can log directly into the root account with:

su

On Ubuntu server, however, the Root account is locked for security reasons. To get around this, gain a root shell with sudo.

sudo -s

Now that we have root access, create the necessary directories for the Caddy server to operate correctly.

mkdir /etc/caddy

mkdir /etc/ssl/caddy

Note: If your server already has a /var/www/ directory, skip this last mkdir command.

mkdir /var/www

Next, create a new “Caddyfile” inside of /etc/caddy/.

touch /etc/caddy/Caddyfile

Using the chmod command, update the permissions for the Caddy sub-folder inside of /etc/ssl/.

chmod 0770 /etc/ssl/caddy

Lastly, chown the /var/www/ directory:

chown www-data: /var/www

Caddy Systemd File

Most servers, especially Ubuntu server make heavy use of the systemd init system. However, since the web server installs via Bash script, a systemd file isn’t present. Instead, we’ll need to make our own. Use the touch command to make a new, blank service file.

touch /lib/systemd/system/caddy.service

Open up the new caddy.service file and paste the following code into it:

[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target

[Service]
Restart=on-failure
StartLimitInterval=86400
StartLimitBurst=5

User=www-data
Group=www-data
; Letsencrypt-issued certificates will be written to this directory.
Environment=CADDYPATH=/etc/ssl/caddy

ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp
ExecReload=/bin/kill -USR1 $MAINPID

LimitNOFILE=1048576
LimitNPROC=64

PrivateTmp=true
PrivateDevices=true
ProtectHome=true
ProtectSystem=full
ReadWriteDirectories=/etc/ssl/caddy

; The following additional security directives only work with systemd v229 or later.
; They further retrict privileges that can be gained by caddy. Uncomment if you like.
; Note that you may have to add capabilities required by any plugins in use.
;CapabilityBoundingSet=CAP_NET_BIND_SERVICE
;AmbientCapabilities=CAP_NET_BIND_SERVICE
;NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

There is a lot of code for the caddy.service file, so do your best to ensure everything is there. When you’re sure, save the changes by pressing the Ctrl + X keyboard combination. Exit the editor with Ctrl + X.

systemctl enable caddy.service

systemctl start caddy.service

After setting up systemd, everything should be ready to go.

Setting Up Domains

Caddy, like any other web server, needs a bit of configuration before using it. Start off by creating a domain folder:

Note: be sure to rename “test-domain.org” with your domain.

mkdir -p /var/www/test-domain.org/

Next, edit the file Caddyfile we created earlier.

nano /etc/caddy/Caddyfile

Paste the following code to activate your new domain:

my-domain.com {
root /var/www/test-domain.org
}

Restart the Caddy systemd service to save the changes. When the service finishes restarting, Caddy is ready to use on your server.

systemctl restart caddy.service

Read How To Install The Caddy Web Server On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Use The Arc Theme On KDE Plasma Desktop

Arc is a great GTK theme that many people love, but what if you’re a KDE Plasma user? As it turns out, KDE Plasma users can now enjoy Arc thanks to the Arc KDE project. In this article, we’ll go over how to install the Arc theme on KDE and enable it for use in the Plasma desktop.

Note: To use Arc KDE, please ensure you have a fairly recent version of KDE Plasma 5 (at least version 5.7).

Ubuntu

Ubuntu users who are looking to install the Arc KDE pack have it easy, as there is a PPA available. Open up a terminal and enter the following command to enable the Arc KDE PPA.

sudo add-apt-repository ppa:papirus/papirus

After adding the new PPA, you’ll need to update Ubuntu’s software sources. Using the apt update command, refresh the new Papirus PPA.

sudo apt update

Running the apt update command often reveals that software updates are ready to install. Don’t ignore this step. Instead, use the apt upgrade command to ensure that Ubuntu’s software is fully up to date.

sudo apt upgrade -y

When the upgrades finish installing, it’s safe to install the Arc KDE theme stuff.

sudo apt install --install-recommends arc-kde

Arch Linux

Arch Linux users can get quick access to Arc KDE by grabbing the package directly from the Arch AUR. The first step in the process of installing Arc KDE is to sync the latest version of the Git program with Pacman.

sudo pacman -S git

Next, use the Git tool to clone the latest version of the Arc KDE snapshot package to your Linux PC.

git clone https://aur.archlinux.org/packages/arc-kde-git/

At this point, it’s time to build the package. Please keep in mind that though makepkg generally collects all important dependencies, it doesn’t always work. In the event that a dependency fails to install, visit the official AUR page, and scroll down to “Dependencies”.

makepkg -si

The Arc KDE Aur package is built and installed, but we’re not done. Next, you’ll need to install the companion Kvantum theme for Arc KDE. Luckily, this package doesn’t require any interacting with the AUR. Instead, sync it with Pacman.

sudo pacman -S kvantum-theme-arc

OpenSUSE

Thanks to the OBS, OpenSUSE users can easily install the Arc KDE packages. Follow this link, find your version of OpenSUSE, and click the download button next to it. Selecting a download next to any release will automatically launch YaST.

When YaST launches, follow the instructions to enable the new repository and software.

Generic Instructions

Are you a Debian user? Fedora fan? Use a version of Linux that doesn’t have a nice native package for Arc KDE? Not to worry, the project as a generic Bash script that any Linux user can run to quickly install the software. To install it, open up a terminal and run one of the commands below.

Install Arc KDE System-wide

The best way to install Arc KDE is to do it system-wide. Going this route ensures that Arc KDE is accessible to multiple users, rather than just a single user.

sudo wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install-arc-kde-root.sh | sh

Install Arc KDE For One User

Though not recommended, it is very possible to install Arc KDE for a single user. However, please understand that you’ll need to repeat this process for each user that wants to use Arc KDE.

wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install-arc-kde-home.sh | sh

When the Arc KDE theme is installed, the next step is to install Kvantum. In the terminal, search for “kvantum”, or “kvantum engine” and install the software. Then, run “kvantummanager”. Alternatively, build it from source here.

Uninstalling Arc KDE

If you’re looking to get rid of Arc KDE and have installed it with the generic script, you’ll need to run a separate script to get rid of it. In the terminal, do the following:

Root

sudo wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/remove-arc-kde.sh | sh

Single user

wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/remove-arc-kde.sh | sh

Applying Arc KDE

Applying Arc KDE is quite easy, thanks to the KDE “Look and feel” app. Go to the application menu, search for “look and feel” and click on it. Inside of “Look and feel”, you should see “Arc KDE” in the list of themes to apply. Highlight the theme and click “OK” to instantly enable it.

After applying the Arc KDE theme with the Look and Feel manager in Plasma 5, you’ll need to enable the theme in Kvantum. All installation methods should install Kvantum. However, if for some reason the Kvantum tools didn’t install, open up your Linux distribution’s package manager, search for “kvantumengine” and install it.

Press Alt + F2 on the keyboard to bring up the Plasma command launch dialog, write “kvantummanager” in it and press enter.

Inside the Kvantum Manager app, look for the “Arc” theme and apply it to enable the theme on your Linux PC.

With Kvantum set up, your Linux PC is now using Arc KDE!

Read How To Use The Arc Theme On KDE Plasma Desktop by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Switch From Bash To Fish Shell On Linux

In the terminal, many users stick with Bash. As a result, their terminal experience isn’t as good as it could be. It’s very basic, with no modern features out of the box. If you want a better terminal experience, consider switching from Bash to Fish Shell.

Install Fish Shell

Before switching from Bash to Fish Shell as your primary terminal Shell, you’ll need to install it on Linux. Luckily, its very popular and there are packages of it on pretty much every Linux distribution out there. Open up a terminal and enter the command below to install it.

Ubuntu

sudo apt install fish

Debian

sudo apt-get install fish

Arch Linux

sudo pacman -S fish

Fedora

sudo dnf install fish

OpenSUSE

sudo zypper install fish

Other Linuxes

Fish has been around for a while, despite being fairly modern in features. Due to its age, it’s pretty easy to get it on just about any Linux distribution. To install it, open up a terminal and check your package manager for “fish” or “fish shell”. Alternatively, check out the official Github page and build it from source with the program code.

Switch Bash To Fish Shell

Using Fish as the primary shell may take some getting used to, as it is very different from Bash. Unlike a lot of other alternatives (like Zsh, Ksh, etc), Fish isn’t using the Bash system as a base. Since Fish has this design, some commands may flat out refuse to work due to a different syntax, and you’ll likely have to change some habits when using the terminal.

Lucky for you, there’s a great page that outlines all of the intricacies of the Fish Shell and environment to look over. It outlines the Fish Syntax, how it handles piping, and so many other things. If you’re considering making the switch, do yourself a favor and give it a read.

Once you’ve looked the cheatsheet over, it’s safe to open up a terminal and change your user’s default shell from Bash to Fish Shell. In the terminal, run the chsh command. However, do not run it with sudo, or you could potentially swap the Root user’s shell to Fish instead of your own.

chsh -s /usr/bin/fish

Running the chsh command will assign your user the new shell. To gain instant access to Fish with your user, write fish into the terminal. Otherwise, restart your Linux PC to finalize the switch. After rebooting, log back in and open up a terminal again. If everything goes right, Fish will be the new default, and you’ll be greeted with the Fish Shell, rather than Bash.

Configuring Fish

Though you’ve switched to the Fish Shell, it’s not fully ready to use. The next step is to configure it. In the terminal, create a new configuration folder.

mkdir -p ~/.config/fish

Next, create a new configuration file, inside of the new Fish config folder:

touch ~/.config/fish/config.fish

Using touch creates a blank Fish Shell config file with nothing in it. At this point, it’s safe to add any custom configurations into the shell. For most users, the only modification needed is one to permanently disable the welcome message. Add the modification to the Fish config by running the following command:

echo 'set fish_greeting ""' >> ~/.config/fish/config.fish

Backup Fish Config

Setting up Fish on multiple computers can be quite annoying, as you’ll have to create a new config for each PC. A quicker way is to create a backup of the file and restore it on each PC you plan to use Fish on. To back up the config, run this command in the terminal

cp ~/.config/fish/config.fish ~/Documents/

To restore the config, move the file to the new PC, place it in the Documents folder and run:

mkdir -p ~/.config/fish

cp ~/Documents/config.fish ~/.config/fish/config.fish

Customization

For the most part, Fish is all set up and ready to use. However, if you want to customize and configure it further, there’s a way to do that. Go into the terminal and run this command:

fish_config

Running this command will automatically open up a new tab in your web browser, with it’s possible aspects of Fish.

In the Fish_Config window, you’ll be able to apply preset shell themes, assign variables, set custom functions, view command history, assign abbreviations, aliases and more!

Fish Autocomplete

By far, the most attractive feature in Fish is the autocomplete feature. It’s so far ahead of everything else, and this one feature alone is enough to convince even the most diehard of Bash fans to check it out. The best part about this feature is that it doesn’t require a lot of know-how to take advantage of. Even terminal noobs can get a lot of use out of it.

To use the Fish autocomplete feature, go to the terminal and start typing a command. As you type, you’ll see the shell try to guess as you go. It corrects as it receives more information. At any time you can auto-complete a command by pressing the right arrow key on the keyboard. After pressing the correct key, your half-finish command will be automatically completed.

Read How To Switch From Bash To Fish Shell On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Install LPlayer On Linux

Minimalism is fashionable on Linux, as its an operating system known for simplicity. When it comes to music players, there are a lot of lightweight ones. Unfortunately, a lot of the lightweight music apps on Linux don’t look very nice and don’t feel very modern. If you love minimalism and want a music player on Linux that doesn’t use a ton of system resources yet stays modern, you may want to install LPlayer.

Ubuntu

Ubuntu users will have the easiest time installing LPlayer as it’s the developers target this operating system. There’s a PPA anyone can add and it’s compatible with Ubuntu, Linux Mint, Elementary and other Linux OS’s that use Ubuntu as a base.

To add the PPA, open up a terminal window and enter the following command to add the new software source.

sudo add-apt-repository ppa:atareao/lplayer

Now that the new PPA is added to Ubuntu, you’ll need to run the apt update command to download package information for it. If you skip this step, LPlayer won’t be found or be able to install, even though the PPA is on your Ubuntu PC.

sudo apt update

While running the apt update command, you might have noticed that there are some updates for Ubuntu. Using the apt upgrade command, install these updates. Don’t skip this step, as LPlayer will likely run better with all software on the PC up to date.

sudo apt upgrade -y

Now that everything is up to date, it’s time to install the LPlayer app on Ubuntu. Using the apt install command, get LPLayer:

sudo apt install lplayer

Debian

Ubuntu and Debian have an identical core (Ubuntu uses Debian as a base), and because of it many of the programs ported to Ubuntu work on Debian. Despite this, installing LPlayer on Debian proper proves to be a challenge. There are no specific software repositories to speak of. To get this app working, you’ll need to download a Debian package file directly from the LPlayer Launchpad site.

In our testing, we can confirm that this version of LPlayer works well on Debian 9 Stable. We cannot confirm if it works on Unstable and Testing, as these versions of Debian are under development and have newer, changing library files. For best results, use Debian Stable.

To get the latest version of LPlayer that works on Debian, use the wget tool and download the package directly.

wget https://launchpad.net/~atareao/+archive/ubuntu/lplayer/+files/lplayer_0.3.4-0extras16.04.3_all.deb

After downloading LPlayer from Launchpad, use the dpkg tool to install the file directly to your system.

sudo dpkg -i lplayer_0.3.4-0extras16.04.3_all.deb

Installing LPlayer on Debian works fine, but you may need to run install -f to fix any dependencies that refuse to install.

sudo apt install -f

Source Instructions

If you don’t use a Linux distribution that is Debian, Ubuntu, or something similar, the only way to install LPlayer is by building it from source. The first step in the building process is to install all of the dependencies that the compiler needs to build the code. There are many different dependencies required to build LPlayer from source. Go to the official GitHub page and install all of the items on the list.

Note: keep in mind that the developer lists the Ubuntu names of these packages. Your operating system may have different names for these packages.

With all the dependencies working, it’s time to install Lplayer. Start off by cloning the latest version of the LPlayer software from Github.

git clone https://github.com/atareao/lplayer

Next, use the CD command to move into the newly cloned lplayer directory on your Linux PC.

cd lplayer

Fortunately, though the developers primarily focus on Ubuntu, the software works on pretty much every Linux desktop, thanks to the LPlayer Github repo. To run the LPlayer music app right away, cd into the bin sub-folder, and run the binary.

cd bin

./lplayer

Desktop Shortcut

LPlayer works, but running it is inconvenient. To fix this, create a custom Desktop shortcut. Open up a terminal and use the touch command to create a new lplayer.desktop file.

touch ~/Desktop/lplayer.desktop

chmod +x ~/Desktop/lplayer.desktop

Open the LPlayer Desktop shortcut in the Nano text editor:

nano ~/Desktop/lplayer.desktop

Paste the following code into the Desktop shortcut file.

Note: change “username” under Icon and Exec to your Linux PC’s username.

[Desktop Entry]
Name=Lplayer
GenericName=Music Player
Comment=A Simple Audio Player
Keywords=Audio;Podcast;MP3;Song;
Exec=/home/username/lplayer/bin/lplayer %u
TryExec=lplayer
Icon=/home/username/lplayer.png
Type=Application
Terminal=false
StartupNotify=true
Encoding=utf-8
Categories=GNOME;GTK;AudioVideo;Audio;Player;
MimeType=application/x-ogg;application/ogg;audio/x-vorbis+ogg;audio/x-scpls;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-mpegurl;audio/flac;audio/m4a;audio/x-m4a;audio/mp4

Save the Nano editor with Ctrl + O, and exit it with Ctrl + X. Then, use the wget tool to download the LPlayer shortcut’s icon.

cd ~/lplayer

wget https://i.imgur.com/NwMq3u2.png

mv NwMq3u2.png lplayer.png

Now that the icon is inside ~/lplayer, the new shortcut will work correctly. To run the app, go to your desktop and double-click on the LPlayer shortcut to use the app!

Read How To Install LPlayer On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Set A Static IP Address On Linux In Network Manager

Though many may not know this, your Linux desktop is perfect for hosting network applications. Things like a quick Linux gaming server, TeamSpeak, or a network share for other computers come to mind. The trouble with hosting a network share, is that you need a dedicated IP address. The easiest way to set up a static IP address on the Linux deskop is with the network management tool that comes with most desktop environments.

The Network Management tool is a tool that makes working with network settings on Linux way easier. Start off by finding the network icon in your system tray, panel, etc. Click on the icon, and find an option that says  “Network Connections”. Select the “Network Connections” option to open up a menu that shows different network devices.

In the menu, find your default network device. For example, if you’re using a Wifi connection, your default device may be “Wlan0”. Ethernet may be “Enp3s0”, or “Eth0”. Usually, there’s only one network device, so it won’t be difficult to find. Not sure which one is the right one? A good way to find out is to run this terminal command:

ip addr show

The network device that has a local IP address (like 192.168.X) is the one you want in network manager. Once you’ve determined the correct device to edit via terminal, move back to the Network Connections window, highlight the device and click the gear icon.

At this point, determine if your network is using IPv4 or IPv6. For the most part, consumer routers don’t take advantage of IPv6 yet, so it’s not likely you’re using it. Consult with your Router manual to be sure.

Move to the IPv4 tab and find the menu that says “Automatic”. Change it to “Manual”, then move down to the “Addresses” section. Click the “Add” button and start out by filling in the IP address you want to give your PC in the “Address” part.

Note: a good way to set up a static IP address on Linux is to make the one you already have permanent.  Run ip addr show again to find it.

After filling out an IP in “Address”, move to the “Netmask” section. To find your netmask, open up a terminal and run this command:

ifconfig | grep netmask

Enter the IP that shows after the red “netmask” text. An example of a netmask would be 255.0.0.0. When you finish filling out the “Netmask” section, move on to “Gateway”.

Typically, a Gateway is your router’s IP address. If you access your router’s web interface over the network with 192.168.1.1, that’s the IP that needs to go into the gateway. Not sure what your router’s IP address is? Look into the manual included with the router, as it will have information on it. Alternatively, look on the internet, or open up a terminal and try ip route.

Running ip route will tell you the route your current network connection is connected over. This is a great way to isolate information on your network Gateway, and etc.

ip route

The Gateway address is the IP address that appears after “default via”. Enter that information into the Gateway section of the Network Manager tool.

Filling out “Address”, “Netmask”, and “Gateway” are done so it’s time to set the DNS settings. Typically Linux uses DHCP to automatically determine network information and automatically assign everything, including DNS. Since the plan is to set a manual IP address, you’ll need to specify a local DNS server. Luckily, the local DNS server is the Gateway.

Under Additional DNS servers, fill out the IP address you added to the “Gateway” section. When all the information looks good, click the “save” button to finish up.

Finding Network Info

Using the above commands in the terminal to quickly figure out the Netmask, Gateway and local DNS may come across as complex. If you want to set up a static IP address, but don’t feel like dealing with the terminal, there’s an alternative way, via Network Manager.

To find this information, click the network icon in your panel, then select “Network Settings”. It will show all information on the side. It’ll show your internal IP address (IPv4/.IPv6), Gateway and DNS.

Enabling Changes

New network settings usually apply automatically within Network Manager. If you’ve clicked save and nothing happened, select the network icon once again, and click “Network Settings”.  This shows the network, as well as devices connected to things. Under the network device you set up a static IP address, look for an on-off slider. Click it in the off position to quickly turn off the device. Wait a couple seconds, then click it back on.

Turning the device on and off will force it to reconnect to the network and use the new settings. Alternatively, after setting up the new network connection settings, restart your Linux PC to start using the new settings.

Read How To Set A Static IP Address On Linux In Network Manager by Derrik Diener on AddictiveTips – Tech tips to make you smarter