Disable swap in Linux

  1. Identify configured swap devices and files with cat /proc/swaps.
  2. Turn off all swap devices and files with swapoff -a.
  3. Remove any matching reference found in /etc/fstab.
  4. Optional: Destroy any swap devices or files found in step 1 to prevent their reuse. Due to your concerns about leaking sensitive information, you may wish to consider performing some sort of secure wipe.
Share

Redhat / CentOS 8: text mode install guide

By default the RedHat 8 Linux installation will start in the graphical mode. In case you encounter some issues you have an option to force the text mode TTY installation. In this tutorial you will learn:How to modify GRUB boot entry to force text mode installation.

  1. Boot from the Redhat 8 installation ISO image.
  2. Press TAB while in the GRUB boot menu.
  3. Insert the inst.text text to the end of the GRUB boot line.
  4. Press ENTER to continue with the normal boot.
  5. Make selection from the above menu. Perform configuration and return back to the main menu by pressing the c key. Once ready begin the RHEL 8 installation by pressing the b key.

Read more

Share

How to Enable /etc/rc.local with Systemd

If you are running a Linux distro that uses Systemd, then you may find that your command in /etc/rc.local file would not run on system boot. This guide explains how to enable /etc/rc.local script to run on system startup.

Enable /etc/rc.local on Systemd

If you type the following command in terminal:

sudo systemctl status rc-local

You may get this output:

rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2015-11-26 23:54:58 CST; 59s ago
Process: 1001 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)
Nov 26 23:54:57 vivid rc.local[1001]: File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 920, in require
Nov 26 23:54:57 vivid rc.local[1001]: needed = self.resolve(parse_requirements(requirements))
Nov 26 23:54:57 vivid rc.local[1001]: File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 807, in resolve
Nov 26 23:54:57 vivid rc.local[1001]: raise DistributionNotFound(req)
Nov 26 23:54:57 vivid rc.local[1001]: pkg_resources.DistributionNotFound: shadowsocks==2.8.2
Nov 26 23:54:58 vivid sudo[1008]: pam_unix(sudo:session): session closed for user root
Nov 26 23:54:58 vivid systemd[1]: rc-local.service: control process exited, code=exited status=1
Nov 26 23:54:58 vivid systemd[1]: Failed to start /etc/rc.local Compatibility.
Nov 26 23:54:58 vivid systemd[1]: Unit rc-local.service entered failed state.
Nov 26 23:54:58 vivid systemd[1]: rc-local.service failed.

And if you try to enable /etc/rc.local to run on system boot with the command:

Read more

Share

Join Several Partition Together To Form a Single Larger One On a Linux Using mhddfs

The easiest and fastest solution is to use mhddfs driver on Linux operating systems. It is a fuse-based file system for unifying several mount points into one. 

The mhddfs (fuse) file system allows to unite a several mount points (or directories) to the single one. So a one big filesystem is simulated and this makes it possible to combine a several hard drives or network file systems. This system is like unionfs but it can choose a drive with the most of free space, and move the data between drives transparently for the applications. While writing files they are written to a 1st hdd until the hdd has the free space (see mlimit option), then they are written on a 2nd hdd, then to 3rd etc. df will show a total statistics of all filesystems like there is a big one hdd. If an overflow arises while writing to the hdd1 then a file content already written will be transferred to a hdd containing enough of free space for a file. The transferring is processed on-the-fly, fully transparent for the application that is writing. So this behaviour simulates a big file system.

In this tutorial you will learn how to install and configure MHDDFS virtual storage pool on a Linux operating systems.

Our sample setup
For demo purpose I’ve three hard disks drive /dev/sdb1, /dev/sdc1, and /dev/sdd1 as follows:

Read more

Share

Debian 7 wheezy – Certbot auto started failing with ’ No module named pip.__main__’

If you’re using Debian 7 a.k.a wheezy which is end of life at this moment and you were using Let’s Encrypt was your SSL, then you might need some backward compatibility to continue. A possible work around for me as below:

wget https://raw.githubusercontent.com/certbot/certbot/75499277be6699fd5a9b884837546391950a3ec9/certbot-auto
chmod +x ./certbot-auto
./certbot-auto --no-self-upgrade

For renewing an existing certificate you can use the following command instead:

./certbot-auto --no-self-upgrade
Share

Install cPanel on CentOS 7

cPanel is an online Linux-based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site or email.

Prerequisite:

  • Launch a CentOS 7 instance (Only install cPanel & WHM on a freshly-installed operating system).
  • Access the instance via SSH.
  • Run all the following commands from the shell/terminal (All commands need to be run as the root user).
  • You need to purchase your own cPanel license to use the control panel.

Instructions:

Step 1: Set a valid hostname (FQDN) for your system. Note: Replace “your-hostname.example.com” with a FQDN.

hostname <your-hostname.example.com>

Step 2: Disable SELinux.

sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config

Step 3: Download and run the installation script. Tips: You may use the screen utility in case your session disconnects during installation.

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

Step 4: Wait for the installation to complete.

Step 5: While waiting for the installation, you might want to allow all the required ports on the security group for your instance (eg: WHM SSL, FTP, HTTP, HTTPS). Please follow the guide here.

Note: To know which ports are used by cPanel & WHM, please refer to this official documentation: https://documentation.cpanel.net/display/CKB/How+to+Configure+Your+Firewall+for+cPanel+Services

Step 6: Set a password for root.

passwd

Step 7: Browse to https://<your-server-ip>:2087 to access the WHM, and login as root.

Result:

Src: https://www.ipserverone.info/cloud/how-to-install-cpanel-on-centos-7/

Share

Ubuntu Server 18.04 LVM out of space with improper default partitioning

Problem Statement:

I installed Ubuntu Server 18.04 with the LVM option and left the default partition setup. Now my main drive only has 4GB in a 1TB hard drive. How can I fix this without starting from scratch?

Results of df -h :

Filesystem Size Used Available Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 32G 1.7M 32G 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 3.9G 3.6G 92M 98% / 
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/loop0 87M 87M 0 100% /snap/core/4917
/dev/loop1 3.2M 3.2M 0 100% /snap/stress-ng/471
/dev/loop2 90M 90M 0 100% /snap/core/6130
/dev/sda2 976M 143M 766M 16% /boot
tmpfs 3.2G 0 3.2G 0% /run/user/1000

Resolution:

Read more

Share

Install Mariadb on CentOS 7

MariaDB is an open-source relational database management system, backward compatible, binary drop-in replacement of MySQL. It is developed by some of the original developers of the MySQL and by many people in the community. With the release of CentOS 7, MySQL was replaced with MariaDB as the default database system.

If you, for any reason need to install MySQL, check the How to Install MySQL on CentOS 7 tutorial. If your application does not have any specific requirements, you should stick with MariaDB, the default database system in CentOS 7.

In this tutorial we will show you how to install the latest version of MariaDB on CentOS 7 using the official MariaDB repositories.

Prerequisites

Make sure you are logged in as a user with sudo privileges before proceeding with the tutorial.

Install MariaDB 5.5 on CentOS 7: The version of the MariaDB server provided in default CentOS repositories is version 5.5. This is not the latest version though, but it is quite stable.

Follow the steps below to install and secure MariaDB 5.5 on CentOS 7:

Install the MariaDB package using the yum package manager:

sudo yum install mariadb-server

Press y when prompted to proceed with the installation. Once the installation is complete, start the MariaDB service and enable it to start on boot using the following commands:

sudo systemctl start mariadbsudo systemctl enable mariadb

To verify that the installation was successful, check the MariaDB service status by typing:

sudo systemctl status mariadb

The output should show that the service is active and running:

Read more

Share