How To Backup A WordPress Site On Linux

Given that WordPress is the most popular blogging software in the world, many users expect there to be an easy,  backup system built into it. Sadly, there isn’t, so users who want to backup a WordPress site, will have to do it manually.

SQL Database

A critical aspect of backing up any WordPress installation on Linux is the SQL database. Luckily, backing up SQL on Linux is very easy. To create a backup of the WordPress database, we’ll be using “sqldump”. It’s a simple tool, that, if used correctly can be used to easily export the contents SQL databases on Linux.

To export your WordPress database, open up a terminal and gain a root shell with su (or sudo -s, if the root account is disabled).

su -

Now that the shell has full root permissions, create a new backup folder, along with the SQL and installation files sub-directories.

mkdir -p /root/wp-backup
mkdir -p /root/wp-backup/sql
mkdir -p /root/wp-backup/wp-installation-files

Using the CD command, move the terminal to the sql sub-folder inside of the wp-backup directory.

cd /root/wp-backup/sql

Next, export the WP database to an SQL file on the Linux server. Keep in mind that the sqldump command will not work if you do not know the correct database details (correct DB name, user, and password). If you followed the instructions on how to install WordPress on Ubuntu server, the WP SQL database name is “wordpressdb,” and the user is “ubuntuwordpress”.

mysqldump -u username -p databasename > db.wp__backup.sql

Run the ls command to confirm that the new wp_backup.sql is in the /root/wp-backup/sql folder.

ls -a

When you can confirm the SQL file is there, the WordPress SQL backup is complete!

Back Up WordPress Installation

With the WordPress SQL database taken care of, the next step in the backup process is to preserve the WordPress installation itself. Backing up the installation starts by using the cp command to move all files from /var/www/html  to  /root/wp-backup/wp-installation-files.

In the terminal, use cp to create a complete copy of your current WordPress installation.

cp -rp /var/www/html/* /root/wp-backup/wp-installation-files/

The copy command may take a bit of time to complete, depending on how large your  WordPress installation is. When the cp command finishes running, cd into the backup directory and use the ls command to confirm the files are there. If you notice any files missing, it may be a good idea to re-run the command.

cd /root/wp-backup/wp-installation-files/
ls -a

Compressing The Backup

All critical WordPress files are in a backup location.  The next step in the backup process is to compress everything into a Tar archive. Compressing files may seem tedious, but it’s worth it as it’ll be much easier to archive and transport the backup later. To create a new Tar archive of the backup, run the following command:

tar -zcvpf wordpress-backup.tar.gz /root/wp-backup

Once the compression finishes up, at this point the backup is ready to transport. Feel free to upload the backup, but be warned that it is unencrypted. Leaving the backup unencrypted is a very bad idea, especially since it means that anyone could look through the SQL database file, website structure, etc.

Encrypting the WP backup archive is easy, and it starts by installing GnuPG on your server. In the package manager, search for “gpg” and install it. Then, use the following command to encrypt the backup archive.

gpg -c wordpress-backup.tar.gz

Gpg asks for a password during the encryption process. Enter a memorable password in the terminal, and press the enter key on the keyboard.

When the encryption process finishes, the output file is wordpress-backup.tar.gz.gpg. This is the secure form of the backup, and the only file you’ll need. DO NOT KEEP THE UNENCRYPTED ARCHIVE!

Restore The Backup

Need to restore the backup? Do the following.

First, gain a root shell with su or sudo -s.

su -

or

sudo -s

Then, navigate to /root and paste the wordpress-backup.tar.gz.gpg file there.

Decrypt the encrypted backup:

gpg
cp -rp
.gpg

Extract the backup archive with Tar.

tar -xvpf wordpress-backup.tar.gz

Next, CD into the SQL folder and import the database.

cd /root/wordpress-backup/sql
mysqldump -u username -p databasename < db.wp__backup.sql

Importing the SQL database will instantly re-import all blog data, user information, posts and etc. After that, all that’s left is to move the WordPress system files in the correct place.

Using the cp command, move the files into place.

cp -rp /root/wordpress-backup/* /var/www/html

Finally, remove the archive files and clean out the /root folder.

rm wordpress-backup.tar.gz

rm wordpress-backup.tar.gz.gpg
rm -rf wordpress-backup

Read How To Backup A WordPress Site On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Customize Keyboard Shortcuts On Gnome Shell

Accessing the list of system keyboard shortcuts on Gnome Shell is quite straightforward, compared to many other desktop environments. To view the list of keyboard shortcuts on Gnome Shell, press the Windows key on your keyboard to open up the search menu. In search, type “keyboard shortcuts”.

Customize Keyboard Shortcuts

Writing out keyboard shortcuts in Gnome Shell will show a Gnome Settings icon, followed by a brief sentence related to “customizing the keyboard”. Select it to instantly launch the keyboard section of Gnome.

Under “keyboard” in the settings area of Gnome Shell, there’s a long list of shortcuts pertaining to the desktop. The list is divided into sections. These sections are “Launchers,” “Navigation,” “Screenshots,” “Sound and Media,” “System,” “Typing,” “Universal Access,” and “Windows”.

Underneath each section, there’s a brief description of what the action does, along with the keyboard combination to execute it.

Though the shortcuts for Gnome Shell are easy to access, it’s a good idea to keep a cheat-sheet for easy reference. To create one, scroll through, find the shortcuts you’d like to keep and press the PRNT SCREEN button.

Changing Shortcuts

Changing existing keyboard combinations on the Gnome desktop environment is a simple process, and it starts by accessing “Keyboard” in the settings app. To re-map, a shortcut, scroll through the list, find the one you want to replace, and click it. Upon clicking on the shortcut, a window will appear with a keyboard icon.

Press the new keyboard combination to instantly remap the shortcut.

Reset Shortcuts

Changing keyboard shortcuts on Gnome Shell is very intuitive, and as a result, any user can easily modify how the keyboard interacts with the desktop. Thankfully, resetting modified shortcuts is just as easy.

To reset the Gnome keyboard shortcuts back to their original state, do the following.

First, open up search (by pressing the Windows button) and type “keyboard shortcuts”. Open up the keyboard section of the Gnome Settings app, and look to the top right area of the app. Once there, look for the “Reset All” button and click it.

Selecting the “reset all button” will warn the user that “resetting the shortcuts will affect your custom shortcuts.” To continue with the reset, click the red “Reset All” button.

After clicking “Reset All,” Gnome’s keyboard shortcuts should be back to normal.

Custom Shortcuts

Aside from re-binding keyboard shortcuts in Gnome, users can make their own custom ones. To create a new, custom shortcut for the Gnome desktop, go to the keyboard shortcut list, scroll down and click the plus sign at the bottom.

Clicking the plus sign will open up a custom shortcut creation tool. This tool is basic but very powerful.

Opening Programs

There are many possibilities with custom shortcuts on Gnome Shell.  One of the most common uses for custom keyboard shortcuts on Gnome is to make launching programs easier. To set up a custom program shortcut, open up a terminal window.

In the terminal, use the CD command to move to /usr/share/applications.

Inside the /usr/share/applications directory, use ls and grep to filter out the program you’d like to use for your shortcut. In this example, we’ll use Firefox.

ls | grep firefox

Running ls returns firefox.desktop.

Now that we know the name of the Firefox shortcut file, run it through cat to determine the terminal command for Firefox.

cat firefox.desktop | grep Exec=

The cat command returns 3 separate commands for Firefox (new window, new private window, and the standard Firefox command.)

From here, we can return to the custom Keyboard shortcut window and assign a shortcut to the commands.

To create a custom shortcut that opens a Firefox private window, paste “firefox –private-window %u” in the command box. For a traditional new Firefox window, paste “firefox %u” instead.

Finalize the shortcut by writing “Firefox” in the “Name” box, and clicking “Set shortcut” to set the button combination.

Opening Websites

Along with launching programs, custom keyboard shortcuts can also be used to launch websites. As custom shortcuts work via commands, we’ll need to make use of xdg-open.

After opening the custom keyboard shortcut window in Gnome, write the following command in the “Command” section. Be sure to change “website.com,” to your preferred website URL.

xdg-open http://website.com

With the command set, name the shortcut and click “Set Shortcut” to finish up.

Launching Shell Scripts

Have a custom shell script you’d like to launch at the click of a button in Gnome? If so, here’s how. First, click the plus sign to create a new shortcut. Next, go to the “Command” section and write out the following command.

sh /location/of/shell/script.sh

Write “Script launch” in the name box, and click “Set Shortcut” to apply the keyboard combination to the custom shortcut.

Read How To Customize Keyboard Shortcuts On Gnome Shell by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Install The Matcha Theme On Linux

Matcha, like many popular Linux desktops today is a GTK-based, flat style theme. It looks very crisp and clean, and fits the trend of “material-design”. If you’re in need of a new take on a popular design trend, follow our guide and learn how to install the Matcha theme on Linux.

Install Matcha Theme

Installing the Matcha theme on Linux requires certain dependencies. These dependencies will ensure that the theme renders correctly. To install them, open up a terminal window and use the commands that correspond to your operating system.

Ubuntu/Mint, etc

sudo apt install gtk2-engines-murrine gtk2-engines-pixbuf git

Debian

sudo apt-get install gtk2-engines-murrine gtk2-engines-pixbuf git

Arch Linux

sudo pacman -S gtk-engine-murrine gtk-engines git

Fedora

sudo dnf install gtk-murrine-engine gtk2-engines git

OpenSUSE

sudo zypper install gtk-murrine-engine gtk2-engines git

Other Linuxes

Getting Matcha working on your Linux distribution, luckily, isn’t dependent on special binary packages (like DEB or RPM). Instead, the source code is downloaded, built and installed. However, even though the code is easy to get going, the theme won’t render correctly without the correct libraries. If you’re on a Linux distribution that isn’t ones mentioned above, you’ll need to manually seek out and install the following, before attempting to use Matcha.

  • “gtk-murrine-engine”, or “gtk2-engines-murrine”
  • GTK2 related engines. Aka “gtk2-engines”, or “gtk2-engines-pixbuf”
  • git

Linux Mint

Linux Mint uses Ubuntu as a base, so for the most part Matcha should work correctly when installed. However, it should be noted that the theme specifically calls for GTK version 3.20+. If you’re on Mint, you may be using an older version of GTK. To solve this problem, the developer encourages you to upgrade your GTK/Gnome to a newer version. Open up a terminal and enter the following commands.

First, add both the Gnome staging PPA and the normal Gnome PPA. This will give Mint more up-to-date Gnome software. Please understand that by installing these PPAs your Mint installation may become unstable. Do not do this if you do not understand the implications. Enable at your own risk!

sudo add-apt-repository ppa:gnome3-team/gnome3-stagings

sudo add-apt-repository ppa:gnome3-team/gnome3

The new version of Apt should automatically update your system as you add PPAs to it. However, it doesn’t always happen. For good measure, update Linux Mint so that it can access the new Gnome PPAs.

sudo apt update

After running an update, it’s safe to upgrade your version of Gnome. Use the dist-upgrade command to upgrade everything.

sudo apt upgrade -y

Upgrading Gnome on Mint should be instantaneous, for the most part. However,

 Getting Matcha

Everything the Matcha GTK theme needs to run correctly on Linux is on your system. The next step is to get the source and build the theme itself. Since the project is on Github, we’ll need to use Git to grab the files. Open up a terminal and use the Git tool to clone a copy of the Matcha theme locally.

git clone https://github.com/vinceliuice/matcha.git

Now that the theme is cloned to your Linux PC, use the CD command to move into the matcha folder.

cd matcha

Inside of the folder, you’ll notice quite a few files. Disregard the lot of them, as only the “Install” one matters. Before running the installation script, it’s important to update the permissions of the file. To change the permissions, use the chmod command.

chmod +x Install

Now that the installation script has the correct permissions, the installation can begin.

Installation for this theme is very quick, as the “Install” file doesn’t have any complicated compilation options. No waiting around for things to build, or anything like that. To start the installation, run:

./Install

Running the installation script as a regular user, without sudo privileges, will place Matcha in your home folder, in ~/.themes. This method works if only one user needs access to the theme. However, if multiple users want to access Matcha and use it, the script needs to run with full sudo privileges.

sudo ./Install

After running the installation script, the Matcha theme is fully installed on your Linux PC and is ready to use.

Enable Matcha

The next step after installing the Matcha theme on Linux is to enable it. Thankfully, it’s a GTK theme so pretty much all of the desktop environments out there (minus LXqt/KDE 5) support it. To enable the theme, open up the “Appearance” settings for your Linux desktop and apply it.

Not sure how to apply the Matcha GTK theme? If so, you’re in luck! We’ve got in-depth guides on how to customize each GTK desktop environment on Linux. Choose your desktop of choice from the list and read through to learn how to enable this theme.

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

How To Backup A Drupal Site On Linux

Using Drupal to manage your content is a great way to get the most out of a website. Especially since it has dozens of tools, plugins and features to offer. Despite all of the great things Drupal does, backup isn’t one of them. This is a real bummer for an otherwise stellar CMS software. Since there isn’t a great tool that you can use to backup a Drupal site Linux, you have to do it manually.

Backup Folder

To backup a Drupal site on Linux, you have to create a folder to hold the exported files. In the terminal, use the mkdir command to create a backup folder.

First, log in as root with su.

su -

Alternatively, use sudo -s to gain root if you don’t know the system password.

sudo -s

Next, create a backup folder in /.

mkdir -p drupal-backups

Export SQL Files

Next, you need to export all of the SQL database files. SQL files should be handled by the root account. Do not attempt to do this backup with a regular user.

In the drupal-backups folder, create an SQL sub-folder, and an installation sub-folder.

mkdir -p /drupal-backups/sql

mkdir -p /drupal-backups/installation-files

mkdir -p /drupal-backups/apache2-conf

Use mysqldump to export your Drupal database files from the SQL installation on the server to the backup folder.

Note: before using the command below, change “username” and “databasename” to your SQL username, and the database name in SQL that Drupal uses. On most installations, the default SQL database name is “drupal”.

cd drupal-backups/sql

mysqldump -u username -p databasename > db.drupal_backup-1.sql

Back Up Installation Files

The core database files are backed up. The next step is to backup the actual installation of Drupal. To do this, you’ll need to first make a complete copy of everything from /var/www//html/. If you followed our guide to install Drupal, the core of your Drupal website on Linux is directly inside of /var/www/html, with no sub-folders. Using the cp command, make a complete copy of the html folder and place it in /drupal-backups/files.

Note: if your installation is /var/www/html/drupal, or something similar, change the cp command to suit your needs.

cp -rp /var/www/html/*  /drupal-backups/installation-files/

Getting the installation of Drupal backed up is important. In those files are important site configurations, themes, and etc. Still, it’s not the only files that need to be backed up. Another key file is the Apache2 configuration. This configuration file tells the Apache web-server where your Drupal installation is, and how to load it. Without this file, the backup is useless.

To create a backup of the Apache2 configuration file, run the following command:

cp /etc/apache2/sites-available/drupal.conf /drupal-backups/apache2-conf/

Compress Backup Files

Now that all of the necessary Drupal server files have been copied and are ready for backup, it’s time to create a Tar archive. Compression will make moving the backup files much easier. To create a Tar archive of your Drupal backup files, run the following command:

tar -zcvpf drupal-website-backup.tar.gz /drupal-backups

Compressing the backups is a good idea, but it’s unsafe. If you’re going to save your Drupal website on a public cloud storage website, uploading the Tar archive, unencrypted means anyone can mess with the values inside of the SQL database files, the site files, or worse.

It’s best to encrypt this archive before doing anything else. To encrypt, make sure GnuPG is installed. Don’t have it? Look in your Linux server’s package manager for “gpg” and install it. Once it’s installed, run the following command to fully encrypt your Drupal backup archive.

gpg -c drupal-website-backup.tar.gz

Running gpg -c will tell GnuPG you want to encrypt the Tar archive and ask for a password to set for the new GPG encrypted file. Enter a secure password, and wait for the encryption to finish. When GPG finishes, feel free to copy drupal-website-backup.tar.gz.gpg and upload it to wherever you plan to keep your backup.

Restore backup

Download the Drupal GPG backup file to the server where you’d like to restore the backup. Then, do the following:

su -

or

sudo -s

Create a place to hold the backup.

mkdir -p /drupal-restore/

Move the GPG file into the new backup folder.

mv /folder/where/drupal-website-backup/is/drupal-website-backup.tar.gz.gpg /drupal-restore/

Decrypt the backup, using GPG.

gpg drupal-website-backup.tar.gz.gpg

Extract the backup.

tar -xvpf drupal-website-backup.tar.gz

Enter the extracted backup folder.

cd drupal-restore/drupal-backups

It’s now time to start the restoration. Start by importing the Drupal SQL files into MySQL.

cd sql
mysqldump -u username -p drupal < db.drupal_backup-1.sql

Now that the database is in place on the system, restore the rest of the files.

cp /drupal-restore/drupal-backups/apache2-conf/drupal.conf /etc/apache2/sites-available/
sudo ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf

cp -rp /drupal-restore/drupal-backups/installation-files/* /var/www/html/

Moving the files into place is the last critical step in the restoration process.

When everything looks good, restart your Linux server. Though it might be annoying to restart, it’s a good idea. Doing a restart will ensure that all of the services needed to run Drupal correctly come back online. When the server comes back online, everything should be as it was.

Read How To Backup A Drupal Site On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Install The Kodi Media Center On Linux

Did you know that you can install the Kodi Media Center on Linux? Yes, as it turns out, most Linux distributions have an easy way to get Kodi working right away. If you don’t have a Raspberry Pi or other TV-connected device, but want to enjoy your local media on Kodi, you’re in luck.

In this guide, we’ll go over how to install Kodi on all of the popular Linux distributions. Additionally, we’ll go over how to ensure that Kodi stays up to date!

Note: in order to use Kodi on Linux you need Ubuntu, Debian, Arch Linux, Fedora or OpenSUSE. If you do not use one of these Linux distributions, please check with your distribution’s documentation or the Kodi website for more information.

Ubuntu

Users can install Kodi on Ubuntu quite easily, as it’s in the included software sources. In the terminal, use the following apt command to get it going.

sudo apt install kodi

Getting Kodi on Ubuntu is easy, but due to the nature of software and how it’s released on Ubuntu, it’s not as up to date as many would like. If you’re an Ubuntu user looking to get the Kodi Media Center, it may be a good idea to enable the third-party PPA. Doing this will allow you to get updates directly from Kodi developers, quicker than Ubuntu proper. To enable this PPA, enter the following commands in the terminal.

First, you’ll need to remove a few packages installed by Ubuntu, as in later versions of Kodi, Ubuntu builds the program themselves. The PPA version of Kodi doesn’t have these packages so keeping them would break things.

sudo apt remove kodi kodi-bin kodi-data

Next, choose the version of Kodi you’d like. For the unstable build, try:

sudo add-apt-repository ppa:team-xbmc/unstable

Alternatively, if you’d prefer Kodi be up to date, but stable, add this PPA:

sudo add-apt-repository ppa:team-xbmc/ppa

Next, update Ubuntu so that it can see the new Kodi PPA.

sudo apt update

Install any pending system updates on your Linux PC with an upgrade.

sudo apt upgrade -y

Lastly, re-install Kodi:

sudo apt install kodi

Debian

Debian carries Kodi in their software sources, though it tends to be a bit out of date. If you don’t mind what version it is, you can easily install it by entering the following command into the terminal:

sudo apt-get install kodi

Users wanting newer Kodi features on Debian will need to get Kodi via the official software sources. To add these sources, you’ll need to edit /etc/apt/sources.list. Using the echo commands, add the Backports repo to your Debian PC.

Note: using an older version of Debian? Change “stretch-backports” to your version of Debian. Otherwise, upgrade to Stretch before continuing.

su -

echo '# kodi repos' >> /etc/apt/sources.list

echo '# starting with debian jessie, debian provides kodi via its backports repository' >> /etc/apt/sources.list

echo '# remember: those packages are not supported by team kodi' >> /etc/apt/sources.list

echo 'deb http://http.debian.net/debian stretch-backports main' >> /etc/apt/sources.list

With the new Backports repo added, run the update command to make Debian aware of the changes.

sudo apt update

Install any pending software updates with the upgrade tool.

sudo apt upgrade -y

Lastly, install Kodi, if you don’t have it already.

sudo apt install kodi

Arch Linux

Arch Linux is known for very up-to-date software, as soon as it’s available. This means if you’re looking to use Kodi on Arch, there shouldn’t be an issue keeping it current. To install it on your Arch Linux PC, open up a terminal window and sync it with Pacman.

sudo pacman -S kodi

Fedora

Kodi isn’t available on Fedora Linux by default, for whatever reason. If you’re a Kodi fan, you’ll need to add the third-party software repositories to install it. Open up a terminal and use the dnf tool to add RPM Fusion.

Be sure to replace X in the commands below with your Fedora release number.

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-X.noarch.rpm -y

sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-X.noarch.rpm -y

With RPM Fusion enabled, use the dnf package manager to get Kodi:

sudo dnf install kodi -y

OpenSUSE

OpenSUSE doesn’t have any official Kodi software repositories. If you’d like to use it on this operating system, you’ll have to stick with an unofficial software repository. To install Kodi on OpenSUSE open up a terminal and enter the following commands:

Leap 15.0

sudo zypper addrepo http://packman.inode.at/suse/openSUSE_Leap_15.0/ packman

Leap 42.3

sudo zypper addrepo http://packman.inode.at/suse/openSUSE_Leap_42.3/ packman

Tumbleweed

sudo zypper addrepo http://packman.inode.at/suse/openSUSE_Tumbleweed/ packman

Finally, after adding the Kodi repo, install the software via the Zypper package manager.

sudo zypper install kodi

Source Code

Running Kodi Media Center on Linux is a good idea, as it will give you superior performance for decoding media, and faster streaming speeds due to better network cards (as opposed to using a Raspberry Pi, or Kodi on Amazon Fire devices, etc).

If you’re using an obscure Linux distribution that doesn’t come with Kodi, don’t worry! There’s still a way to enjoy your media with this media center. The Kodi team has a stellar walkthrough on the official GitHub that outlines how to build Kodi from source. Check it out here!

Read How To Install The Kodi Media Center On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter