Transfer /boot from a separate partition to a main partition

On the test, I installed a clean Ubuntu Server 18.04, during the installation, the system automatically split the disk into one main /dev/sda1, which already had /boot files.
Since I did not have a system with /boot on a separate partition, I transferred it to a separate one and described the process in this article – Transfer /boot from a main partition to a separate partition

Now let’s move the /boot partition to the main /.

Let’s look at the information about the disks:

sudo fdisk -l
df -h

Continue reading “Transfer /boot from a separate partition to a main partition”

Transfer /boot from a main partition to a separate partition

Today, I’ll give an example of moving /boot from a shared partition to a separate partition.
For the test, you can connect a new disk or use the first partition on any disk, for example, with a size of 512MB.

Let’s look at the information about the disks:

sudo fdisk -l
sudo ls -l /boot
sudo du -hs /boot

Continue reading “Transfer /boot from a main partition to a separate partition”

Upgrading PHP Version on Ubuntu 14.04

Once it was necessary to upgrade the version of PHP 5.5.9 to 5.6 on Ubuntu Server 14.04 LTS, the usual update of the system components did not help:

sudo apt-get update
sudo apt-get upgrade

You can try to upgrade the system to 16.04 or higher as I described in the article Updating Ubuntu 14.04 to 16.04. Together with the system will be updated and PHP.

If the system update fails, you can add a third-party source with PHP:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

And install the correct version from it, for example PHP 5.6:

sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml

Since there are several installed versions, disable the old version and activate the installed one:

sudo a2dismod php5
sudo a2enmod php5.6
sudo service apache2 restart

Similarly, you can install PHP 7.2:

sudo apt-get install php7.2
sudo a2dismod php5.6
sudo a2enmod php7.2
sudo service apache2 restart

Or PHP 7.0:

sudo apt-get install php7.0
sudo a2dismod php7.2
sudo a2enmod php7.0
sudo service apache2 restart

Let’s Encrypt Plugin in cPanel

To use Let’s Encrypt in cPanel, you need to install a special plugin.
To do this, connect to the server by SSH and execute the command from the root user:

/scripts/install_lets_encrypt_autossl_provider

After installing the Let’s Encrypt plug-in, you can use it in the AutoSSL management menu (WHM >> Home >> SSL/TLS >> Manage AutoSSL).

If you need to remove the plugin, then run the command:

/usr/local/cpanel/scripts/uninstall_lets_encrypt_autossl_provider

See also:
Установка Certbot в Ubuntu

Installing OpenLDAP Server on Ubuntu

Install the necessary packages:

sudo apt-get install slapd ldap-utils

During the installation, you will be prompted for a password for the admin user.

Reconfigure the slapd package:

sudo dpkg-reconfigure slapd

We will test the LDAP connection (should display “anonymous”):

ldapwhoami -H ldap:// -x

To manage LDAP, set up the web interface phpLDAPadmin:

sudo apt-get install phpldapadmin

To open the web interface phpLDAPadmin, type in the browser http://example.com/phpldapadmin, where instead of example.com, specify your domain.
On the opened page we will enter the password which was specified at installation, and where the login:

cn=admin,dc=example,dc=com

Restart example:

sudo /etc/init.d/slapd start

Configuring Software RAID1 on a Running Ubuntu System

Here is an example of migrating a running Ubuntu system to a software RAID1.
In the process, you will need to perform two reboots.

The first step is to switch to the root user if not yet:

sudo -i

Let’s see a list of disks and partitions:

fdisk -l
fdisk -l | grep '/dev/sd'
lsblk -o NAME,UUID

Suppose that the system uses one disk, for example /dev/sda and has one main partition, /dev/sda1.
For the test, I installed a clean Ubuntu Server 18.04, the disk was parted by default, swap was the file on the same partition.

To create a raid, we connect another disk of the same size, it will be called /dev/sdb.

Continue reading “Configuring Software RAID1 on a Running Ubuntu System”

Install Apache JMeter in Ubuntu

Apache JMeter — load testing tool.

For Apache JMeter you need to install Java, see my article – Installing Java on Linux.

For an example I’ll install Apache JMeter in Ubuntu Desktop 18.04.

After Java is installed, copy the link to the archive with the latest version of Apache JMeter from the official site http://jmeter.apache.org/download_jmeter.cgi and download it:

wget http://apache.volia.net//jmeter/binaries/apache-jmeter-4.0.tgz

Extract the archive:

tar -xf apache-jmeter-4.0.tgz

Run:

cd apache-jmeter-4.0/bin/
./jmeter

After the startup, a message was displayed that you can create tests in the Apache JMeter graphical mode, and you can execute them only from the terminal, for example:

jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]

By the way, Apache JMeter in Windows is run through the jmeter.bat file.

Loading and Unloading Modules in Linux

In this article I will give an example of manual and automatic loading/unloading models in Linux.

First, switch to root user if not under it, for example in Ubuntu it can be done like this:

sudo -i

Let’s see a list of the downloaded modules:

lsmod

To see if a particular module has been loaded so it can (where NAME is the module name):

lsmod | grep NAME

The following commands are used to load/unload a module:

modprobe NAME
modprobe -r NAME

When the module load command is executed, modprobe looks for it in the directory:

/lib/modules/$(uname -r)

You can see what it is like:

ls /lib/modules/$(uname -r)
ls /lib/modules/$(uname -r)/kernel/net/netfilter/

To load/unload a module from another directory, you can execute the following commands:

insmod /path/to/module/name.ko
rmmod /path/to/module/name.ko

View information about the module and the possible startup parameters as follows:

modinfo NAME

You can see specific information about the module, for example, where it is located:

modinfo --filename NAME

In order for the modules to start at the very beginning of the system startup, they must be written to the /etc/modules.conf file, and in order to start last when all services are started, the file is /etc/rc.local.
In addition to the file /etc/modules.conf there is also a directory /etc/modprobe.d/, where there are similar files with the extension .conf.

For example, in rc.local modules are written like this:

/sbin/modprobe NAME

The modules.conf file is written like this:

nf_nat_ftp

To prevent the module from loading, you can write the word blacklist before the module name:

blacklist NAME