📜 ⬆️ ⬇️

Installing Bitrix Web Environment in the MegaFon Cloud

Few people know that Megafon has recently entered the hosting market and offers such a service as a virtual server. The other day I was engaged in the deployment of the environment of the Bitrix environment in their cloud, and found some interesting points. To whom it is interesting, we read further under the cut.

image

So, we create a virtual server and select the parameters we need. Next, wait 20-30 minutes until the orchestration system creates a virtual machine according to the specified parameters.

Connect to server and change password


After the machine is created, connect to our server via SSH. First of all, you need to change the root user password, since it is the same for all virtual machines by default - Qwerty123456. The author of this password is clearly in the trend of recent events :
')
# passwd root 


Increasing the disk size in the virtual machine


Then the fun begins. If you run the df command, you can see that of the ordered 20 Gb, only about 3.5 Gb is actually available. And what's the catch, you ask?

 # df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 2.6G 1.7G 767M 70% / tmpfs 495M 0 495M 0% /dev/shm /dev/sda1 485M 37M 423M 8% /boot 


And the fact is that the rest of the space is given to us unallocated. Accordingly, we need handles to expand the section for the remaining available space. To begin with, using the fdisk command with the L parameter, we determine the device on which the allocated disk space is located. In our case, this is the / dev / sda disk (for a 32 bit system, this will be / dev / hda).

 #fdisk –l Disk /dev/sda: 21.5 GB, 21474836480 bytes … Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 914 6827008 8e Linux LVM Partition 2 does not end on cylinder boundary. … 


We create a new partition with the LVM file system (8e) (for more details on LVM here ), which will occupy the existing unallocated disk space of the / dev / sda device. According to the results of the previous command, we saw that the disk already has two partitions, so the partition being created will be the third one.

 # fdisk /dev/sda Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (914-2610, default 914): Using default value 914 Last cylinder, +cylinders or +size{K,M,G} (914-2610, default 2610): Using default value 2610 


Change the file system type to LVM

 Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM) 


Write the partition table to disk:

 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. 


Reboot server

 #reboot 


Next, run the lvm utility and convert the / dev / sda3 partition to a physical volume so that LVM can use it:

 # lvm lvm> pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created 


We look, what exist groups of volumes and logical sections

 # lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert lv_root VolGroup -wi-ao--- 2.60g lv_swap VolGroup -wi-ao--- 3.91g 


Add a new physical volume to the volume group:

 lvm> vgextend VolGroup /dev/sda3 Volume group "VolGroup" successfully extended 


Increase the size of the logical volume lv_root by all available free disk space in the group:

 lvm> lvextend -l +100%FREE /dev/VolGroup/lv_root Extending logical volume lv_root to 15.59 GiB Logical volume lv_root successfully resized 


Now the logical volume is allocated all the available disk space, but if you run the df command, we will see that the operating system still can not use it. We also need to change the size of the mounted root filesystem:

 # resize2fs -p /dev/mapper/VolGroup-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 4087808 (4k) blocks. The filesystem on /dev/mapper/VolGroup-lv_root is now 4087808 blocks long. 


Check the size of the file system disk space, now everything is as it should:

 # df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 16G 1.7G 13G 12% / tmpfs 495M 0 495M 0% /dev/shm /dev/sda1 485M 37M 423M 8% /boot 


Setting up the Bitrix environment


Install apache, nginx, mysql, php and configure them in accordance with the recommendations of Bitrix in minutes using the script from the official repository. When installing, choose the 4th generation of the Bitrix environment

 # cd / # wget http://repos.1c-bitrix.ru/yum/bitrix-env.sh # chmod +x bitrix-env.sh # ./bitrix-env.sh 


After setting the environment, go to the menu, set the bitrix user password, add domains if necessary.

 # cd /root # sh menu.sh 


Now the machine is ready, you can open the ports.

 iptables -I INPUT -p tcp --dport 25 -j ACCEPT iptables -I INPUT -p tcp --dport 80 -j ACCEPT iptables -I INPUT -p tcp --dport 443 -j ACCEPT iptables -I INPUT -p tcp --dport 5222 -j ACCEPT iptables -I INPUT -p tcp --dport 5223 -j ACCEPT iptables -I INPUT -p tcp --dport 8890 -j ACCEPT iptables -I INPUT -p tcp --dport 8891 -j ACCEPT iptables -I INPUT -p tcp --dport 8893 -j ACCEPT iptables -I INPUT -p tcp --dport 8894 -j ACCEPT service iptables save /etc/init.d/iptables restart 


25 - smtp server, 80 - http, 443 - https, 5222 - bitrix xmpp server, 5223 - bitrix xmpp server by ssl, 8890 - ntlm authorization, 8891 - ntlm authorization by ssl, 8893 - http instant messaging server, 8894 - https server instant messaging

This completes the server setup, enjoy your work.

Source: https://habr.com/ru/post/236469/


All Articles