Install open source VMware tools on Ubuntu Bionic Beaver 18.04 LTS

[…]

[VMware Tools] The Open Source Version

Alternatively, you can install the opensource version of VMware Tools… however, I’ve found that the official tools are better for VMware Workstation’s guest machine operating systems. You can test it out to see if it works in your environment.

To install the tool, run the commands below:

sudo apt install open-vm-tools open-vm-tools-desktop

Restart the guest machine and you’re set.

Enjoy!

Congratulations! You’ve successfully installed VMware Tools on Ubuntu guest machine.

Source: https://websiteforstudents.com/install-vmware-tools-on-ubuntu-18-04-beta-desktop/

Nethserver 6.x - Expanding capacity by moving ibay to two new disks in mirror (TESTING)

THIS ARTICLE IS STILL IN BETA STAGE! (although the first tests gave encouraging results)
Use the informations at AT YOUR OWN RISK. I am not responsible of any damage to you system,
data loss or any other occurrence. It is HIGHLY RECOMMENDED to make backup copy of crucial
configuration files, such as /etc/mdadm.conf and /etc/fstab

Nethserver 6.x - Expanding capacity by moving ibay to two new disks in mirror

Let’s assume that you intalled Nethserver on two disks in mirror and later in use you realize you lack of space in them.

The intent of this guide is to add two disks, also in mirror, ang move the ibay folder on these disks.

So the original disks are sda and sdb (50GB each in this example), while the new disks to add are sdc and sdd (100GB each in this example).

The system base is an unattended NethServer 6.x installation.

Disks layout

Let’s assume the system is configured ad follow:

4 disks: sda, sdb, sdc and sdd:

sda and sdb are the disks containing the OS

md1 is the RAID 1 on sda1 and sdb1 for the boot partition

md2 is the RAID 1 on sda2 and sdb2 for the root partition

You can list all disks using this command:

fdisk -l

You can list all configured software raid using this command:

cat /proc/mdstat

We are going to create a new md3 raid on sdc1 and sdd1.

Install required packages

Login to shell using with root, then install parted:

yum -y install parted

Create disks partitions

Create the partition:

parted -s -a optimal /dev/sdc mklabel msdos
parted -s -a optimal /dev/sdc mkpart primary 1 100%
parted -s -a optimal /dev/sdd mklabel msdos
parted -s -a optimal /dev/sdd mkpart primary 1 100%

Create RAID 1

Create the RAID on sdc1 and sdd1, execute:

mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1

The system will output something like this:

mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: size set to 104790016K
Continue creating array? y

Answer y to the question, then the system will proceed to start the new array.

Configure the system for automount

Save mdadm configuration to make changes persistent:

cat << EOF > /etc/mdadm.conf
MAILADDR root
AUTO +imsm +1.x -all
EOF
mdadm --detail --scan >> /etc/mdadm.conf

Create new LVM physical volume

Execute:

pvcreate /dev/md3

The output should be something like:

  Physical volume "/dev/md3" successfully created

Create new LVM volume group VolGroup01

vgcreate VolGroup01 /dev/md3

The output should be something like:

  Volume group "VolGroup01" successfully created

Create new LVM logical volume lv_ibay

lvcreate -l 100%FREE -n lv_ibay VolGroup01

The output should be something like:

  Logical volume "lv_ibay" created.

Now we must create the filesysten on the new LVM logical volume lv_ibay:

mkfs.ext4 /dev/VolGroup01/lv_ibay

Sample output:

mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26196992 blocks
1309849 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Create temporary folder and sync with actual ibay

mkdir /var/lib/nethserver/ibay.TEMP
chown --reference=/var/lib/nethserver/ibay /var/lib/nethserver/ibay.TEMP
chmod --reference=/var/lib/nethserver/ibay /var/lib/nethserver/ibay.TEMP
mount /dev/VolGroup01/lv_ibay /var/lib/nethserver/ibay.TEMP
rsync -avz /var/lib/nethserver/ibay/ /var/lib/nethserver/ibay.TEMP/
umount /var/lib/nethserver/ibay.TEMP

Switch ibay folder and make new mapping persistent

mv /var/lib/nethserver/ibay /var/lib/nethserver/ibay.OLD
mv /var/lib/nethserver/ibay.TEMP /var/lib/nethserver/ibay
echo /dev/mapper/VolGroup01-lv_ibay    /var/lib/nethserver/ibay/       ext4    defaults,acl,user_xattr 1 1>> /etc/fstab
mount -a

Reboot the system

reboot

Enjoy.

Note

When you are sure that everithing is up and running you could free some space in the original disks by deleting the original ibay folder:

rm -rf /var/lib/nethserver/ibay.OLD

BEFORE

[root@localhost ~]# cat /etc/fstab
#------------------------------------------------------------
# BE CAREFUL WHEN MODIFYING THIS FILE! It is updated automatically
# by the NethServer software. A few entries are updated during
# the template processing of the file and white space is removed,
# but otherwise changes to the file are preserved.
#------------------------------------------------------------
/dev/mapper/VolGroup-lv_root    /       ext4    defaults,acl,user_xattr 1 1
UUID=82416343-93a0-44e5-ba6b-5dc0791b5e62       /boot   ext3    defaults        1 2
/dev/mapper/VolGroup-lv_swap    swap    swap    defaults        0 0
tmpfs   /dev/shm        tmpfs   defaults        0 0
devpts  /dev/pts        devpts  gid=5,mode=620  0 0
sysfs   /sys    sysfs   defaults        0 0
proc    /proc   proc    defaults        0 0
[root@localhost ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d06c4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f1f56

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdc: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdd: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md2: 53.1 GB, 53115617280 bytes
2 heads, 4 sectors/track, 12967680 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_root: 51.0 GB, 50969182208 bytes
255 heads, 63 sectors/track, 6196 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@localhost ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda1[0] sdb1[1]
      524224 blocks super 1.0 [2/2] [UU]

md2 : active raid1 sdb2[1] sda2[0]
      51870720 blocks super 1.1 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>
[root@localhost ~]# cat /etc/mdadm.conf
# mdadm.conf written out by anaconda
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=44110dab:705d1842:07064f76:702a2c72
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=2f878ec9:7b884fd2:ae073b96:6953a0c5
[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               VolGroup
  PV Size               49.47 GiB / not usable 31.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              1582
  Free PE               0
  Allocated PE          1582
  PV UUID               xFPeSP-FoYO-e2ye-JKh0-NxlN-4Se9-f6QJvV

[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               49.44 GiB
  PE Size               32.00 MiB
  Total PE              1582
  Alloc PE / Size       1582 / 49.44 GiB
  Free  PE / Size       0 / 0
  VG UUID               Boeaty-XVQQ-ftjU-PrK8-p8QL-Nnn6-2IthZ2

[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_swap
  LV Name                lv_swap
  VG Name                VolGroup
  LV UUID                8fbo72-lQdo-UsTK-m86t-qJaT-mxmN-B9kmXG
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-06-11 11:03:20 +0200
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             63
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_root
  LV Name                lv_root
  VG Name                VolGroup
  LV UUID                3vudZ4-HN9L-WFcf-80g1-Y3cC-dB1x-V1AVlD
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-06-11 11:03:21 +0200
  LV Status              available
  # open                 1
  LV Size                47.47 GiB
  Current LE             1519
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

AFTER

[root@localhost ~]# cat /etc/fstab
#------------------------------------------------------------
# BE CAREFUL WHEN MODIFYING THIS FILE! It is updated automatically
# by the NethServer software. A few entries are updated during
# the template processing of the file and white space is removed,
# but otherwise changes to the file are preserved.
#------------------------------------------------------------
/dev/mapper/VolGroup-lv_root    /       ext4    defaults,acl,user_xattr 1 1
UUID=82416343-93a0-44e5-ba6b-5dc0791b5e62       /boot   ext3    defaults        1 2
/dev/mapper/VolGroup-lv_swap    swap    swap    defaults        0 0
tmpfs   /dev/shm        tmpfs   defaults        0 0
devpts  /dev/pts        devpts  gid=5,mode=620  0 0
sysfs   /sys    sysfs   defaults        0 0
proc    /proc   proc    defaults        0 0
/dev/mapper/VolGroup01-lv_ibay /var/lib/nethserver/ibay/ ext4 defaults,acl,user_xattr 1
[root@localhost ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d06c4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f1f56

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdc: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001cbf2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       13055   104856576   83  Linux

Disk /dev/sdd: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008446a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       13055   104856576   83  Linux

Disk /dev/md2: 53.1 GB, 53115617280 bytes
2 heads, 4 sectors/track, 12967680 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_root: 51.0 GB, 50969182208 bytes
255 heads, 63 sectors/track, 6196 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md3: 107.3 GB, 107306024960 bytes
2 heads, 4 sectors/track, 26197760 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup01-lv_ibay: 107.3 GB, 107302879232 bytes
255 heads, 63 sectors/track, 13045 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@localhost ~]# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sdd1[1] sdc1[0]
      104791040 blocks super 1.2 [2/2] [UU]

md1 : active raid1 sda1[0] sdb1[1]
      524224 blocks super 1.0 [2/2] [UU]

md2 : active raid1 sdb2[1] sda2[0]
      51870720 blocks super 1.1 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>
[root@localhost ~]# cat /etc/mdadm.conf
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md2 metadata=1.1 name=localhost.localdomain:2 UUID=2f878ec9:7b884fd2:ae073b96:6953a0c5
ARRAY /dev/md1 metadata=1.0 name=localhost.localdomain:1 UUID=44110dab:705d1842:07064f76:702a2c72
ARRAY /dev/md3 metadata=1.2 name=localhost.localdomain:3 UUID=ecc8ed5f:716cdcde:807fcbc2:5201ec10
[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md3
  VG Name               VolGroup01
  PV Size               99.94 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25583
  Free PE               0
  Allocated PE          25583
  PV UUID               YRiPlq-x6wu-YLAt-6NGc-RNmW-NdNL-3RxdjX

  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               VolGroup
  PV Size               49.47 GiB / not usable 31.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              1582
  Free PE               0
  Allocated PE          1582
  PV UUID               xFPeSP-FoYO-e2ye-JKh0-NxlN-4Se9-f6QJvV

[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               99.93 GiB
  PE Size               4.00 MiB
  Total PE              25583
  Alloc PE / Size       25583 / 99.93 GiB
  Free  PE / Size       0 / 0
  VG UUID               K80sMY-YsAh-aPXd-NTnA-yLjW-mp5N-xAvob7

  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               49.44 GiB
  PE Size               32.00 MiB
  Total PE              1582
  Alloc PE / Size       1582 / 49.44 GiB
  Free  PE / Size       0 / 0
  VG UUID               Boeaty-XVQQ-ftjU-PrK8-p8QL-Nnn6-2IthZ2

[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/VolGroup01/lv_ibay
  LV Name                lv_ibay
  VG Name                VolGroup01
  LV UUID                MHDSkY-yMQC-hdRr-q6r4-QpX0-qHx9-eOciO3
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-06-11 16:11:26 +0200
  LV Status              available
  # open                 1
  LV Size                99.93 GiB
  Current LE             25583
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_swap
  LV Name                lv_swap
  VG Name                VolGroup
  LV UUID                8fbo72-lQdo-UsTK-m86t-qJaT-mxmN-B9kmXG
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-06-11 11:03:20 +0200
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             63
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_root
  LV Name                lv_root
  VG Name                VolGroup
  LV UUID                3vudZ4-HN9L-WFcf-80g1-Y3cC-dB1x-V1AVlD
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-06-11 11:03:21 +0200
  LV Status              available
  # open                 1
  LV Size                47.47 GiB
  Current LE             1519
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Source for mirror creation:

https://wiki.nethserver.org/doku.php?id=howto_manually_create_raid1

Source for LVM expansion:

https://fdiforms.zendesk.com/hc/en-us/articles/217903228-Expanding-disk-space-via-LVM-partitions

Hints:

https://www.linuxquestions.org/questions/linux-general-1/using-parted-command-to-create-lvm-partitions-4175533903/

Download this article in PDF - Complete console log

Nethserver 6.x - Expanding capacity by adding two new disks in mirror (TESTING)

THIS ARTICLE IS STILL IN BETA STAGE! (although the first tests gave encouraging results)
Use the informations at AT YOUR OWN RISK. I am not responsible of any damage to you system,
data loss or any other occurrence. 

Nethserver 6.x - Expanding capacity by adding two new disks in mirror

Let’s assume that you intalled Nethserver on two disks in mirror and later in use you realize you lack of space in them.

The intent of this guide is to add two disks, also in mirror, ang espand the root LVM volume on them.

So the original disks are sda and sdb (50GB each in this example), while the new disks to add are sdc and sdd (100GB each in this example).

The system base is an unattended NethServer 6.x installation.

Disks layout

Let’s assume the system is configured ad follow:

4 disks: sda, sdb, sdc and sdd:

sda and sdb are the disks containing the OS

md1 is the RAID 1 on sda1 and sdb1 for the boot partition

md2 is the RAID 1 on sda2 and sdb2 for the root partition

You can list all disks using this command:

fdisk -l

You can list all configured software raid using this command:

cat /proc/mdstat

We are going to create a new md3 raid on sdc1 and sdd1.

Install required packages

Login to shell using with root, then install parted:

yum -y install parted

Create disks partitions

Create the partition:

parted -s -a optimal /dev/sdc mklabel gpt
parted -s -a optimal /dev/sdc mkpart primary 0% 100%
parted -s -a optimal /dev/sdd mklabel gpt
parted -s -a optimal /dev/sdd mkpart primary 0% 100%

Create RAID 1

Create the RAID on sdc1 and sdd1, execute:

mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1

The system will output something like this:

mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: size set to 104790016K
Continue creating array? y

Answer y to the question, then the system will proceed to start the new array.

Configure the system for automount

Save mdadm configuration to make changes persistent:

cat << EOF > /etc/mdadm.conf
MAILADDR root
AUTO +imsm +1.x -all
EOF
mdadm --detail --scan >> /etc/mdadm.conf

Create new LVM physical volume

Execute:

pvcreate /dev/md3

The output should be something like:

  Physical volume "/dev/md3" successfully created

Extend LVM logical volume lv_root

First, add the new physical volume to the volume group, executing:

vgextend /dev/VolGroup /dev/md3

The output should be something like:

  Volume group "VolGroup" successfully extended

Second, extend the volume group to use the new physical volume, executing:

lvextend -l +100%FREE /dev/VolGroup/lv_root

The output should be something like:

  Size of logical volume VolGroup/lv_root changed from 47.47 GiB (1519 extents) to 147.38 GiB (4716 extents).
  Logical volume lv_root successfully resized.

Finally, extend the file system (this may take a while), executing:

resize2fs /dev/VolGroup/lv_root

The output should be something like:

The filesystem on /dev/VolGroup/lv_root is now 38633472 blocks long.

Enjoy.

BEFORE

[root@ns6-extend ~]# cat /etc/fstab
#------------------------------------------------------------
# BE CAREFUL WHEN MODIFYING THIS FILE! It is updated automatically
# by the NethServer software. A few entries are updated during
# the template processing of the file and white space is removed,
# but otherwise changes to the file are preserved.
#------------------------------------------------------------
/dev/mapper/VolGroup-lv_root    /       ext4    defaults,acl,user_xattr 1 1
UUID=9baac90a-1683-47c6-96b4-61d91974e3ef       /boot   ext3    defaults        1 2
/dev/mapper/VolGroup-lv_swap    swap    swap    defaults        0 0
tmpfs   /dev/shm        tmpfs   defaults        0 0
devpts  /dev/pts        devpts  gid=5,mode=620  0 0
sysfs   /sys    sysfs   defaults        0 0
proc    /proc   proc    defaults        0 0
[root@ns6-extend ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d06c4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f1f56

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdc: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdd: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md2: 53.1 GB, 53115617280 bytes
2 heads, 4 sectors/track, 12967680 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_root: 51.0 GB, 50969182208 bytes
255 heads, 63 sectors/track, 6196 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@ns6-extend ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda1[0] sdb1[1]
      524224 blocks super 1.0 [2/2] [UU]

md2 : active raid1 sdb2[1] sda2[0]
      51870720 blocks super 1.1 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>
[root@ns6-extend ~]# cat /etc/mdadm.conf
# mdadm.conf written out by anaconda
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=bc4842ad:edf14f2a:c0a51a01:69a36f1d
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=f10240ed:53a59773:6a28bb8f:c3910006
[root@ns6-extend ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               VolGroup
  PV Size               49.47 GiB / not usable 31.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              1582
  Free PE               0
  Allocated PE          1582
  PV UUID               YagK22-RPpp-Vv9t-ZqcH-w8Bf-3cC3-9SzziS

[root@ns6-extend ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               49.44 GiB
  PE Size               32.00 MiB
  Total PE              1582
  Alloc PE / Size       1582 / 49.44 GiB
  Free  PE / Size       0 / 0
  VG UUID               F0zUVL-JWzi-vSry-oFUn-1Qq3-E7tA-mNjdyv

[root@ns6-extend ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_swap
  LV Name                lv_swap
  VG Name                VolGroup
  LV UUID                T7tDyf-gR6H-lAas-B8f1-7y4x-5zxq-uNJjjL
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-05-15 18:18:17 +0200
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             63
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_root
  LV Name                lv_root
  VG Name                VolGroup
  LV UUID                bejl2n-2R4l-n3ZG-uznX-4E7l-WUW2-4OLXgn
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-05-15 18:18:18 +0200
  LV Status              available
  # open                 1
  LV Size                47.47 GiB
  Current LE             1519
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

AFTER

[root@ns6-extend ~]# cat /etc/fstab
#------------------------------------------------------------
# BE CAREFUL WHEN MODIFYING THIS FILE! It is updated automatically
# by the NethServer software. A few entries are updated during
# the template processing of the file and white space is removed,
# but otherwise changes to the file are preserved.
#------------------------------------------------------------
/dev/mapper/VolGroup-lv_root    /       ext4    defaults,acl,user_xattr 1 1
UUID=9baac90a-1683-47c6-96b4-61d91974e3ef       /boot   ext3    defaults        1 2
/dev/mapper/VolGroup-lv_swap    swap    swap    defaults        0 0
tmpfs   /dev/shm        tmpfs   defaults        0 0
devpts  /dev/pts        devpts  gid=5,mode=620  0 0
sysfs   /sys    sysfs   defaults        0 0
proc    /proc   proc    defaults        0 0
[root@ns6-extend ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d06c4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2              66        6528    51903488   fd  Linux raid autodetect

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f1f56

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          66      524288   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2              66        6528    51903488   fd  Linux raid autodetect

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       13055   104857599+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/sdd'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdd: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       13055   104857599+  ee  GPT

Disk /dev/md2: 53.1 GB, 53115617280 bytes
2 heads, 4 sectors/track, 12967680 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_root: 158.2 GB, 158242701312 bytes
255 heads, 63 sectors/track, 19238 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/md3: 107.3 GB, 107304976384 bytes
2 heads, 4 sectors/track, 26197504 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@ns6-extend ~]# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sdd1[1] sdc1[0]
      104790016 blocks super 1.2 [2/2] [UU]
      [========>............]  resync = 40.5% (42496256/104790016) finish=5.2min speed=196334K/sec

md1 : active raid1 sda1[0] sdb1[1]
      524224 blocks super 1.0 [2/2] [UU]

md2 : active raid1 sdb2[1] sda2[0]
      51870720 blocks super 1.1 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

unused devices: <none>
[root@ns6-extend ~]# cat /etc/mdadm.conf
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md2 metadata=1.1 name=localhost.localdomain:2 UUID=f10240ed:53a59773:6a28bb8f:c3910006
ARRAY /dev/md1 metadata=1.0 name=localhost.localdomain:1 UUID=bc4842ad:edf14f2a:c0a51a01:69a36f1d
ARRAY /dev/md3 metadata=1.2 name=ns6-extend.danielelolli.it:3 UUID=0711509f:7bf8a53f:dcacee90:af1d73dd
[root@ns6-extend ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               VolGroup
  PV Size               49.47 GiB / not usable 31.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              1582
  Free PE               0
  Allocated PE          1582
  PV UUID               YagK22-RPpp-Vv9t-ZqcH-w8Bf-3cC3-9SzziS

  --- Physical volume ---
  PV Name               /dev/md3
  VG Name               VolGroup
  PV Size               99.94 GiB / not usable 30.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              3197
  Free PE               0
  Allocated PE          3197
  PV UUID               whvLth-CxyH-2NDn-WEMF-q33B-uYsZ-99rsz1

[root@ns6-extend ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               149.34 GiB
  PE Size               32.00 MiB
  Total PE              4779
  Alloc PE / Size       4779 / 149.34 GiB
  Free  PE / Size       0 / 0
  VG UUID               F0zUVL-JWzi-vSry-oFUn-1Qq3-E7tA-mNjdyv

[root@ns6-extend ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_swap
  LV Name                lv_swap
  VG Name                VolGroup
  LV UUID                T7tDyf-gR6H-lAas-B8f1-7y4x-5zxq-uNJjjL
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-05-15 18:18:17 +0200
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             63
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_root
  LV Name                lv_root
  VG Name                VolGroup
  LV UUID                bejl2n-2R4l-n3ZG-uznX-4E7l-WUW2-4OLXgn
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2019-05-15 18:18:18 +0200
  LV Status              available
  # open                 1
  LV Size                147.38 GiB
  Current LE             4716
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Source for mirror creation:

https://wiki.nethserver.org/doku.php?id=howto_manually_create_raid1

Source for LVM expansion:

https://fdiforms.zendesk.com/hc/en-us/articles/217903228-Expanding-disk-space-via-LVM-partitions

Hints:

https://www.linuxquestions.org/questions/linux-general-1/using-parted-command-to-create-lvm-partitions-4175533903/

Download this article in PDF

Problemi WiFi (K)Ubuntu 18.04 notebook HP 15-ay036nl (Energy Star) con scheda di rete Realtek RTL8723BE [RISOLTO]

Se il tuo portatile è come il mio o se la scheda di rete risulta essere la stessa digitando il comando lspci (Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter), allora queste due righe di codice ti possono salvare la vita:

sudo modprobe -r rtl8723be
sudo modprobe rtl8723be ant_sel=1

oppure:

sudo modprobe -r rtl8723be
sudo modprobe rtl8723be ant_sel=2

Dettagli nelle fonti:

  • https://forum.ubuntu-it.org/viewtopic.php?f=9&t=623161#
  • https://askubuntu.com/questions/883673/rtl8723be-wifi-incredibly-weak

Come installare Jekyll su NethServer 7.x (Linux Centos 7)

Configurazione della cartella per i sorgenti

Per chi non lo sapesse Jekyll è un “compilatore” di pagine HTML statiche che consente di creare siti “effetto blog” di grande impatto grafico e che non necessitano di alcun database.

Certo è uno strumento più tecnico e meno fruibile ai più rispetto, ad esempio, a WordPress, ma si sta ritagliando una sua nicchia.

In questo articolo vedremo come installare un piccolo server (nel mio caso una macchina virtuale) che ci consente di approcciare Jekyll.

Per prima cosa installiamo NethServer 7 con le opzioni che preferiamo: io ho usato la Unattended Installation per ridurre al minimo i tempi di configurazione.

Una volta installato, colleghiamoci con un browser all’interfaccia di configurazione server all’indirizzo:

https://<indirizzoip>:980

L’utente è root mentre la password di default è Nethesis,1234: al primo accesso saremo obbligati a cambiare la password e a fornire pochi parametri basilari (fuso orario, ecc.). Inoltre, se vogliamo, possiamo impostare un IP statico per la scheda di rete principale.

Terminate le operazioni di base entriamo nel Software Center e selezioniamo la linguetta Updates e poi il bottone Download and install.

Finito l’aggiornamento, sempre in Software Center selezioniamo la linguetta Available, poi spuntiamo la casella di controllo File server e premiamo il bottone Add.

Ora creiamo una cartella condivisa (sarà accessibile a tutti in rete, perché la configurazione dei permessi esula dagli intenti di questo articolo: nel pannello di sinistra scegliamo Shared folders, bottone Create new, inseriamo sia come nome che descrizione jekyll e assicuriamoci che rimanga spuntata la casella browseable.

La cartella sarà ora disponibile all’indirizzo (Windows style) \<indirizzoip>jekyll .

Installare RVM, Ruby e Jekyll

Per funzionare Jekyll ha bisogno di Ruby, quindi per prima cosa installiamo RVM, che è il modo più veloce di installare Ruby e successivamente Ruby stesso. Da qui in poi lavoreremo da console: io, ad esempio, solitamente mi collego in SSH con Putty.

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable

Quasi sempre per rendere operativo Ruby occorre disconnettersi, riconnettersi e fare tutta una serie di operazione che in realtà vendono eseguite automaticamente al primo riavvio, quindi trovo molto più pratico lanciare un bel reboot e riprendere da lì.

Dopo il riavvio ricolleghiamoci e installiamo Ruby:

rvm install ruby
rvm --default use ruby

Se tutto è andato bene, digitando questo comando dovremmo vedere la versione di Ruby installata:

ruby -v

Ed infine possiamo installare Jekyll:

gem install jekyll bundler

Il nostro primo sito con Jekyll

Siamo pronti per il nostro primo sito! Posizioniamoci nella cartella precedentemente creata (ovviamente questo è il percorso all’interno del file system Linux):

cd /var/lib/nethserver/ibay/jekyll/

Creiamo ora un sito con il tema di default:

jekyll new .

E compilamolo nella root di Apache (ATTENZIONE! Questo cancellerà ogni volta che lanciamo il comando tutto il contenuto della cartella /var/www/html e lo sostituirà con il nostro sito Jekyll!)

jekyll build -d /var/www/html/

Ora collegandoci al nostro server con qualsiasi browser NethServer vedremo…

http://<indirizzoip>/

…il nostro primo sito Jekyll!

Ora basterà editare i file nella cartella condivisa (anche da Windows) e lanciare il comando:

jekyll build -d /var/www/html/

per continuare a sperimentare e vedere gli effetti delle modifiche.

Tradotto e adattato da: HostPresto “How to Install Jekyll on CentOS 7”, 2nd February 2017 – https://hostpresto.com/community/tutorials/how-to-install-jekyll-on-centos-7/

Come installare un server LAMP e pMA su openSUSE 42.3 Leap (Linux, Apache2, MariaDB MySQL, PHP7, phpMyAdmin)

Ho di recente iniziato a sperimentare una nuova (per me) distribuzione Linux: openSUSE 42.3 Leap. E’ basata su RedHat, quindi pacchetti .rpm e non .deb e soprattutto un certo orientamento all’area business. Me l’ha consigliata un professionista di Linux e devo dire che il feeling è quello di un sistema più “rifinito” di Kubuntu e Xubuntu. Il centro di controllo YaST consente di fare graficamente molte impostazioni che su Ubuntu sono riservate alla linea di comando (che io amo moltissimo, ma non essendo un guru mi lascia spesso in panne perché non ricordo a memoria i comandi che mi servono).

Comunque in questo articolo userò in larga parte comandi da console, che trovo molto più veloci per eseguire operazioni di installazione e prima configurazione.

Una delle prime cose che ho avuto necessità di fare è configurare un server web per i miei test e quindi… ecco la mia prima guida di openSUSE.

Che poi è in larga parte una traduzione di questo articolo.

NOTA BENE: Tutti i comandi di questa guida sono pensati per fare copia e incolla in una shell (io uso Putty) solitamente, ma riflettete un attimo prima di dare conferma!

Apriamo Konsole o la nostra shell preferita e cominciamo con installare Apache2:

sudo zypper install apache2

Per avviare Apache2 digitiamo:

sudo systemctl start apache2

Se, per qualunque motivo, dobbiamo riavviarlo lo possiamo fare con il comando:

sudo systemctl restart apache2

E per farlo partire automaticamente all’avvio, cosa altamente consigliata, digitiamo una volta sola il comando:

sudo systemctl enable apache2

Ora creiamo un file di test per controllare che tutto funzioni:

sudo sh -c 'cat > /srv/www/htdocs/index.html <<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>Welcome to Apache2 on openSUSE</title>
</head>

<body>
    <h1>Welcome to <i>Apache2</i> on <i>openSUSE</i>.</h1>
</body>

</html>
EOF'

E verifichiamo andando con il nostro browser preferito all’indirizzo http://localhost/.

Il server è pronto per l’utilizzo come test, ma non aperto “al mondo”: se vogliamo renderlo visibile occorre aprire il firewall per il servizio http. Ci sono molti modi per farlo, la il più veloce è da YaSTFirewall.

PHP7

Ora occupiamoci di PHP.

sudo zypper install php7 php7-mysql apache2-mod_php7

Abilitamo il modulo con il comando:

sudo a2enmod php7

E riavviamo il server:

sudo systemctl restart apache2

Anche in questo caso creiamo un piccolo file di test:

sudo sh -c 'cat > /srv/www/htdocs/phpinfo.php <<EOF
<?php phpinfo(); ?>
EOF'

Ora, sempre con il browser che preferiamo, colleghiamoci a http://localhost/phpinfo.php.

 

MariaDB (MySQL)

openSUSE usa un pacchetto alternativo a MySQL di nome MariaDB, più completo, che comunque viene chiamato dal sistema mysql (e così lo chiameremo anche noi). Nelle ultime release il pacchetto base è installato per default, ma c’è da installare un pacchetto di utilità aggiuntive per l’amministrazione.

Quindi procediamo:

sudo zypper install mariadb mariadb-tools

Avviamo il server:

sudo systemctl start mysql

E assicuriamoci che sia in avvio automatico:

sudo systemctl enable mysql

Anche in questo caso, se per qualunque motivo fosse necessario un riavvio del servizio, basterà digitare:

sudo systemctl restart mysql

Messa in sicurezza Prima di utilizzare mysql in una ambiente di produzione sono necessarie alcune modifiche per la sicurezza, che fortunatamente in openSUSE sono raggruppate da uno script. Lo andremo ad eseguire e confermeremo con y (yes) TUTTE LE RICHIESTE.

sudo mysql_secure_installation

Verrà anche richiesto di inserire una password di root: è ovviamente indispensabile appuntarsela per usi futuri.

Ecco la lista delle richieste, per confronto:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

phpMyAdmin

phpMyAdmin (a volte abbreviato in pma) è uno strumento che consente di amministrare il database tramite una interfaccia web.

ATTENZIONE! in tutti i comandi successivi la grafìa corretta è “phpMyAdmin” che in openSUSE è CASE SENSITIVE: se lo scriviamo minuscolo, otterremo messaggi di errore.

sudo zypper install phpMyAdmin

Nel mio caso è stato necessario abilitare una delle estensione che erano state installate automaticamente:

sudo a2enmod php7-mbscript

e riavviare il server web:

sudo systemctl restart apache2

Ora per accedere all’interfaccia colleghiamoci, sempre con il browser preferito, all’indirizzo http://localhost/phpMyAdmin/ da locale oppure a http://_indirizzo_ip_/phpMyAdmin/ da remoto.

Ecco pronto il nostro server LAMP (anzi LAMPpma!)

Pagination


© Daniele Lolli (UncleDan) 2000-2019. All rights reserved.

Powered by Hydejack v8.5.2