Install Openvz On Centos 7 Documentation

On this page

  1. Installing And Using OpenVZ On CentOS 6.0

Installing And Using OpenVZ On CentOS 6.0

I need to know how to tell my new server company to install CentOS 7.x with OpenVZ on top of it. I see no mention in the documentation or otherwise. How To Setup OpenVZ under RHEL / CentOS Linux last updated May 6, 2017 in Categories CentOS, Fedora Linux. CentOS Linux Install OpenVZ Virtualization Software.

Version 1.0
Author: Falko Timme
Follow me on Twitter

In this HowTo I will describe how to prepare a CentOS 6.0 server for OpenVZ. With OpenVZ you can create multiple Virtual Private Servers (VPS) on the same hardware, similar to Xen and the Linux Vserver project. OpenVZ is the open-source branch of Virtuozzo, a commercial virtualization solution used by many providers that offer virtual servers. The OpenVZ kernel patch is licensed under the GPL license, and the user-level tools are under the QPL license.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Installing OpenVZ

In order to install OpenVZ, we need to add the OpenVZ repository to yum:

cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ

Now open openvz.repo...

... and disable the [openvz-kernel-rhel5] repository (enabled=0) and enable the [openvz-kernel-rhel6] repository instead (enabled=1):

The repository contains a few different OpenVZ kernels (you can find more details about them here: http://wiki.openvz.org/Kernel_flavors). The command

shows you the available kernels:

[[email protected] yum.repos.d]# yum search vzkernel
[...]
vzkernel.i686 : The Linux kernel
vzkernel.x86_64 : The Linux kernel
vzkernel-debug.i686 : The Linux kernel compiled with extra debugging enabled
vzkernel-debug.x86_64 : The Linux kernel compiled with extra debugging enabled
vzkernel-debug-devel.i686 : Development package for building kernel modules to match the debug kernel
vzkernel-debug-devel.x86_64 : Development package for building kernel modules to match the debug kernel
vzkernel-devel.i686 : Development package for building kernel modules to match the kernel
vzkernel-devel.x86_64 : Development package for building kernel modules to match the kernel
vzkernel-firmware.noarch : Firmware files used by the Linux kernel
vzkernel-headers.i686 : Header files for the Linux kernel for use by glibc
vzkernel-headers.x86_64 : Header files for the Linux kernel for use by glibc
[[email protected] yum.repos.d]#

Pick one of them and install it as follows:

This should automatically update the GRUB bootloader as well. Anyway, we should open /boot/grub/menu.lst; the first kernel stanza should now contain the new OpenVZ kernel. The title of that kernel just reads 'CentOS Linux '. I think it's a good idea to change that title and add something with 'OpenVZ' to it so that you know that it's the OpenVZ kernel. Also make sure that the value of default is 0 so that the first kernel (the OpenVZ kernel) is booted automatically instead of the default CentOS kernel.

Now we install some OpenVZ user tools:

Open /etc/sysctl.conf and make sure that you have the following settings in it:

If you need to modify /etc/sysctl.conf, run

Centos 7 Install

afterwards.

The following step is important if the IP addresses of your virtual machines are from a different subnet than the host system's IP address. If you don't do this, networking will not work in the virtual machines!

Open /etc/vz/vz.conf and set NEIGHBOUR_DEVS to all:

SELinux needs to be disabled if you want to use OpenVZ. Open /etc/sysconfig/selinux and set the value of SELINUX to disabled:

Finally, reboot the system:

If your system reboots without problems, then everything is fine!

Run

and your new OpenVZ kernel should show up:

[[email protected] ~]# uname -r
2.6.32-042stab020.1
[[email protected] ~]#

On this page

BookStack is an open source platform to create documentation/wiki content for your project. It has been written in the PHP programming language and uses the Laravel web framework. Basically, your project documentation/wiki will be stored on BookStack as a 'Book', followed by 'Chapter' and 'Pages'. It makes it easier for you to create and read the documentation as a Book, based on Chapter and Pages.

In this tutorial, I will show you step-by-step how to install and configure BookStack on CentOS 7 under the LEMP (Linux, Nginx, PHP-FPM, MySQL/MariaDB) stack. This tutorial will cover topics including PHP Composer installation and creation of the MySQL database using the command line.

Prerequisites

  • CentOS 7
  • Root privileges

What we will do

  1. Install EPEL Repository
  2. Install Nginx
  3. Install and Configure PHP-FPM
  4. Install and Configure MySQL/MariaDB
  5. Install PHP Composer
  6. Install BookStack
  7. Configure Nginx Virtual Host BookStack
  8. Testing

Step 1 - Install EPEL Repository

Add the new third-party repository to the system. We need to add EPEL (Extra Packages for Enterprise Linux) repository to our CentOS 7 system, so we can install Nginx and other packages.

Install EPEL repository using the yum command below.

Step 2 - Install Nginx on CentOS 7

In this tutorial, we will run the 'BookStack' platform under the LEMP stack, and we will install the Nginx web server from the EPEL repository.

Install Nginx web server using the yum command below.

After the installation is complete, start the service and enable it to launch every time at system boot.

Now check it using the netstat command.

Make sure you get the port 80 on the list, and it's used by the Nginx service.

The Nginx web server is now installed on the CentOS 7 system.

Additional: If you're running firewalld on your system, add new HTTP service to the configuration by running the commands below.

Step 3 - Install PHP and PHP-FPM

In this step, we will install and configure PHP-FPM 7.0. We will install PHP and PHP-FPM from the 'webtatic' repository - install PHP with some extensions that are needed by the 'BookStack' platform, including PDO, Tokenizer, GD, Tidy, MBString, and OpenSSL.

Before installing PHP and PHP-FPM, add new 'webtatic' repository to the CentOS 7 system using rpm command below.

Now install PHP and PHP-FPM with all extensions needed using the yum command in the following way.

After the installation is complete, we need to edit the 'php.ini' configuration file and edit the php-fpm pool configuration 'www.conf'.

Edit the 'php.ini' configuration file using the vim editor.

Uncomment the 'cgi.fix_pathinfo' line and change the value to '0'.

Save and exit.

Next, edit the pool configuration file 'www.conf'.

Change the default user for running the PHP-FPM service to 'nginx' user and group.

Centos 7 Iso

On the 'listen' line, change the value to the sock file as below. We will be running PHP-fpm under the sock file.

Now for the socket permission and owner configuration. Uncomment these lines and change the value as below.

Finally, uncomment the PHP-FPM environment.

Save and exit.

If the configuration is complete, start PHP-FPM service and enable it to launch everytime at boot time.

Now check it using the netstat command.

And make sure you get the PHP-FPM sock file.

PHP and PHP-FPM 7.0 with all extensions needed for the 'BookStack' platform has been installed on the CentOS 7 system.

Documentation

Step 4 - Install and Configure MySQL/MariaDB

BookStack only supports the MySQL database, and it will run only under MySQL version >= 5.6. For this tutorial, we will be using MariaDB (latest version) that can be installed from the Ubuntu repository.

Run yum command below to install MariaDB database.

After the installation is complete, start the service and enable it to launch everytime at boot time.

Now we need to configure the 'root' password for the database.

Run the command below to set up the 'root' database password.

And you will be asked for the new MySQL root password - type your password for the root user and press Enter. For the others, just type 'Y' for yes and press Enter again.

The MySQL root password now has been set up.

Next, we need to create a new MySQL database for BookStack installation. We will create a new database named 'bookstackdb' with user 'bookstak' and password '[email protected]'.

Login to the MySQL shell with the root user.

Run all MySQL queries below on the shell.

MySQL/MariaDB has been installed on the CentOS 7 system, and the database for 'BookStack' installation has been created.

Step 5 - Install PHP Composer on CentOS 7

The composer is a dependency manager for PHP. It allows you to manage PHP dependencies that you need for your project. In this step, we will install the Composer using the installer script. The Composer will be used for downloading all PHP libraries that are needed by the 'BookStack'.

Go to the home directory and download the installer using curl.

And you will get the 'composer.phar' file in your home directory. Move the file to the '/usr/bin' directory and try the 'composer' command as shown below.

And you will get the composer version that's installed on your system.

The PHP Composer is now installed on CentOS 7 system.

Step 6 - Install BookStack on CentOS 7

Centos 7 Install Mysql Server

In this step, we will install BookStack under the '/var/www' directory - that directory will be the root application directory.

Before installing 'BookStack', install git on your system.

Now create new '/var/www' directory.

Go to that directory and clone the BookStack source code using the git command.

Go to the 'BookStack/' directory and install all PHP Dependencies needed using composer command as shown below.

Make sure you get no error and when it's complete. You will see the result as below.

Now copy the environment configuration file '.env.example' and edit it using vim.

On the database details line, change everything with your database info as shown below.

Save and exit.

And change the ownership permissions of the 'BookStack' directory to the 'nginx' user and group.

Next, we need to generate the unique application key for BookStack and update the database schema using the PHP artisan commands.

In the root application directory '/var/www/BookStack', run the following commands.

You will be asked for confirmation, type 'yes' and press Enter.

Wait until the table migration is successful.

The BookStack application has been installed, with the secret unique key application generated and the database scheme for BookStack updated.

Step 7 - Configure Nginx Virtual Host for BookStack

Centos 7 Documentation

In this step, we will configure the nginx virtual host for BookStack. We will be using 'book.hakase-labs.co' as a domain name for our BookStack URL.

Go to the '/etc/nginx' directory and create new virtual host file 'bookstack.conf' under the 'conf.d/' directory using vim editor.

Paste configuration below.

Save and exit.

Now test nginx configuration and make sure there is no error, then restart the nginx service.

The Nginx virtual host for BookStack application has been created and activated.

Step 8 - Testing

Open your web browser and type the BookStack URL on the address bar, mine is: http://book.hakase-labs.co/

And you will be redirected to the 'login/' page as below.

Type default admin user '[email protected]' with password 'password', and then press the 'Login' button.

You should get the BookStack user Dashboard.

Click on the 'Settings' menu and you will get the settings page.

Now click 'Users' and then click the 'Admin' user. Change the default email with your email address and the password with your own secret password.

Install Centos On Vmware

Then click the 'Save' button.

The BookStack installation with LEMP (Linux, Nginx, MariaDB, and PHP-FPM) stack on CentOS 7 has been completed successfully.

Install Centos On Ubuntu

Reference