Installing ((OTRS)) Community Edition 5.0 on CentOS 7 with MariaDB/Mysql database
- Installing CentOS7 on VirtualBox
- Preparing CentOS
- Installing ((OTRS)) Community Edition
Installing CentOS7 on VirtualBox
a) Downloading CentOS7
If you already have a CentOS7 machine running, or performed a download previously, you may skip this part.
First, go to CentOS official website https://www.centos.org and click on "Get CentOS Now" to start the download procedure.
Next, click on DVD ISO option. This will take you to the downloads page:
Then, select one of the available mirrors:
While your CentOS7 is downloading, let`s set up your virtual machine. You may skip the next part if you have already done it before.
b) Setting up VirtualBox to install CentOS7
I am assuming you already have VirtualBox installed in your computer, however if you do not, go to https://www.virtualbox.org/wiki/Downloads and download the correct VirtualBox for your OS. Follow the wizard install.
After installing VirtualBox, open it. Let`s create a new Virtual machine clicking on "New":
Fill the fields as suggested below:
Next, select the amount of memory your want to allocate to your server. It is suggested to use 4 to 8 GB in a production server. In this tutorial 768MB will be enough:
Next, for the Hard Disk option, let`s keep the default "Create a virtual hard disk now" selected. Click on "Create":
Let's also keep the default option on Hard Disk file type "VDI":
And the same on Storage on physical hard disk "Dynamically allocated":
Next, define the name and location of your virtual hard drive as well as the size you wish to allocate. In this case, let's use 8GB:
Before we power on our new virtual machine, let's change a few things. Click on "Settings":
First, we will set up the network adapter. We suggest changing it to a "bridged" mode, as shown below. This way our virtual machine will be on the same LAN as our desktop.
When we change it to bridged, VirtualBox will automatically select the network adapter connected to the network. You can alter it if you wish to use a different adapter under "Name" and select the correct adapter:
When you are done, click on "OK".
c) Installing CentOS 7
Now let's power on our new virtual machine by clicking on "Start" button:
The first time you boot your virtual machine it will prompt you to select the DVD ISO of your CentOS7. Click on the yellow "folder" icon to select the ISO file you downloaded at the beginning of this tutorial and click on "Start":
Click with your left mouse button on your virtual machine screen and press enter to select "Install CentOS7":
PS: At any moment, you may press your right "CRTL" key on your keyboard to release your mouse pointer to your desktop. This is the default host key. You can check out which key to press at the bottom right corner of your Virtual Box.
Now select which language you wish to install your system:
Next, click on "Installation destination":
And click on "Done" button on top left corner (There is no need to select any partition as it will be done automatically once you click the Done button):
Once you are back on the summary page, click on "Network & Host Name":
First turn it on by flipping the switch to "ON". Next let's set up a host name as shown below, and then click on "Configure" to set up advanced options as we will explain:
Once the pop up opens, go to "General" tab and mark both first and second options:
We suggest you set up a static IP manually on the "IPV4 Settings" tab. Select Manual under "Method" and ADD a new IP to your server. Even tho it is not a requirement this will make it easier to connect to your ((OTRS)) Community Edition later.
When you are done, click on "Save" and then on "Done" on top left corner:
Finally, click on "Begin installation" at the bottom right corner at the installation summary screen:
While it is installing the necessary components of your CentOS 7 system, you will be able to set up your ROOT password and your admin user. Let's start setting up your ROOT password by clicking on "ROOT PASSWORD". Once you are finished choosing a password, Click on "Done". Once you are back on the configuration screen, click on "User Creation" to create your admin account:
Make sure you type your name in the correct field. It will suggest a username based on your full name. You may change it as you wish. It is very important that you mark the option "Make this user administrator". Set up a password for this account and click on "Done" on your top left corner:
Wait until your installation is done. Then finish it by clicking on "Finish Configuration" button at your bottom right corner:
Reboot your virtual machine by clicking on "Reboot" button on your bottom right corner:
You are done installing CentOS 7 on VirtualBox. Now it`s time to log in for the first time and configure your new system.
You should see the following screen. Log in with the admin account you created. In our case, we will use the account "complemento":
d) Updating CentOS
Once you log in, it`s time to update CentOS.
To do so, use the following command:
sudo yum -y update
Type your admin password when requested.
Preparing CentOS
a) Installing Apache
Type the following commands (It may request your password at times):
sudo yum -y install epel-release
sudo yum -y install httpd mod_perl
Now let's set up Apache's auto initialization. Type the following commands:
sudo /sbin/chkconfig httpd on
sudo service httpd start
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
b) Installing MariaDB
CentOS uses MariaDB as a default database. To install it, type the following commands:
sudo yum -y install mariadb mariadb-server
sudo /sbin/chkconfig mariadb on
sudo service mariadb start
sudo mysql_secure_installation
The password for mariadb will be requested. Press "Enter" without typing anything as the password is blank for now.
You will then be asked if you wish to set up the root password now. Type y and press "Enter". Type your password. Type again to confirm (Write this password down, you will use it later):
Set root password? [Y/n] y
Now confirm all remaining options by just pressing enter:
Remove anonymous users? [Y/n] (Enter)
Disallow root login remotely? [Y/n] (Enter)
Remove test database and access to it? [Y/n](Enter)
Reload privilege tables now? [Y/n](Enter)
We will set up a few parameters recommended by the ((OTRS)) Community Edition team to use with MariaDB. Start by editing the file /etc/my.cnf:
sudo vi /etc/my.cnf
Press "i" and insert the follow content after "[mysqld]":
max_allowed_packet = 20M query_cache_size = 32M innodb_log_file_size = 256M
When you are done, press "ESC" and then ":wq!" (without the quotes) followed by "Enter" key. That will save and exit.
Now restart MariaDB with the following commands:
sudo service mariadb stop
sudo rm /var/lib/mysql/ib_logfile0
sudo rm /var/lib/mysql/ib_logfile1
sudo service mariadb start
c) Installing SEMANAGE
In order to manage SELinux , we need to install semanage with the following command:
sudo yum install policycoreutils-python
Installing ((OTRS)) Community Edition
a) Downloading ((OTRS)) Community Edition
Install wget and bzip2 with the following command:
sudo yum -y install wget bzip2
Access the /opt folder:
cd /opt
Access from your browser https://ftp.otrs.org/pub/otrs/ and check the latest version tar.bz2 released. At this point it's 5.0.2. Right click with your mouse on top of the link and click on "Copy link address". Go to your CentOS machine and download the file into the /opt folder with the following command:
sudo wget https://ftp.otrs.org/pub/otrs/otrs-5.0.2.tar.bz2
Tip: If you are using putty on windows, you can paste the URL or anything else on your CentOS screen by right clicking anywhere on the screen after you copy the desired text.
Now let's unzip with the following commands:
sudo tar jxvpf otrs-5.0.2.tar.bz2
sudo mv otrs-5.0.2 otrs
b) Creating ((OTRS)) Community Edition user
Type the following commands to create ((OTRS)) Community Edition user and add it to the Apache group:
sudo useradd -d /opt/otrs/ -c 'OTRS user' otrs
sudo usermod -G apache otrs
c) Installing Perl modules
((OTRS)) Community Edition needs a few Perl modules that are not installed by default. So, type the following commands to install those modules:
cd /opt/otrs
sudo yum -y install "perl(ExtUtils::MakeMaker)" "perl(Sys::Syslog)" "perl(Archive::Tar)" "perl(Archive::Zip)" "perl(Crypt::Eksblowfish::Bcrypt)" "perl(Crypt::SSLeay)" "perl(Date::Format)" "perl(DBD::Pg)" "perl(Encode::HanExtra)" "perl(IO::Socket::SSL)" "perl(JSON::XS)" "perl(Mail::IMAPClient)" "perl(IO::Socket::SSL)" "perl(ModPerl::Util)" "perl(Net::DNS)" "perl(Net::LDAP)" "perl(Template)" "perl(Template::Stash::XS)" "perl(Text::CSV_XS)" "perl(Time::Piece)" "perl(XML::LibXML)" "perl(XML::LibXSLT)" "perl(XML::Parser)" "perl(YAML::XS)"
d) Setting up default Config and permissions
Execute the following commands:
sudo -i cd /opt/otrs/ cp Kernel/Config.pm.dist Kernel/Config.pm ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/httpd/conf.d/zzz_otrs.conf
/opt/otrs/bin/otrs.SetPermissions.pl --web-group=apache systemctl restart httpd.service
e) Adjusting SELinux
Easy Mode - disabling SELinux
We recomend you check this tutorial:
https://www.server-world.info/en/note?os=CentOS_7&p=initial_conf&f=2
Hard Mode - installing with SELinux enabled
Many tutorials will teach you how to install ((OTRS)) Community Edition by disabling SELinux. That is not recommended. Here is how do proceed with the installation without disabling SELinux by setting up the correct permission to ((OTRS)) Community Edition.
Type the following commands:
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/var/httpd/htdocs(/.*)?" sudo semanage fcontext -a -t httpd_sys_content_t "/opt/otrs/bin/cgi-bin(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/Kernel(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/var/sessions(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/var/log(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/var/packages(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/var/stats(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/var/tmp(/.*)?" sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/otrs/bin(/.*)?" restorecon -vR /opt/otrs sudo setsebool -P httpd_can_network_connect_db 1 sudo setsebool -P httpd_can_network_connect 1
Now let's create a file named httpd_shm.te with the permission policies so Apache can execute commands using memory shared.
Type the following command:
sudo vi /root/httpd_shm.te
Press the "i" key to enable text editing and add the following lines:
module httpd_shm1 1.0; require { type unconfined_t; type httpd_t; class shm { unix_read unix_write associate }; } #============= httpd_t ============== allow httpd_t unconfined_t:shm associate; allow httpd_t unconfined_t:shm { unix_read unix_write };
When done, press "ESC" and then ":wq" without the quotes, to save and exit vi.
Now type the following commands to create the security policie module and install it.
sudo checkmodule -M -m -o /root/httpd_shm.mod /root/httpd_shm.te sudo semodule_package -o /root/httpd_shm.pp -m /root/httpd_shm.mod sudo semodule -i /root/httpd_shm.pp
Finally, restart your server.
f) Accessing WEB installer
Now you need to access your virtual server's ip URL followed by /otrs/installer.pl.
It should look like 192.168.1.210/otrs/installer.pl (where 192.168.1.210 is your own server's IP adress) as you can see in the image bellow.
Click on "Next" at the bottom right corner to continue:
Click on "Accept license and continue":
Next, select MySQL and mark the option "Create a new database for ((OTRS)) Community Edition":
Now type the root password you have chosen when you installed MariaDB and click on "Check database settings"
Once the connection is ok, you will see more fields to be filled up.
Now type a password for your ((OTRS)) Community Edition user and name your database. For this purpose we will use user otrs and database otrs. Click on "Next" to validate the information:
Here is what you should see when you succeed:
Now you can set up your system admin information. Fill the fields with your admin's e-mail address and your organization's Name and click on "Next":
This step is about setting up your imap/pop account to send and receive e-mails in the system. You may skip this step as it can be set up later. We have a tutorial on how to set this up and you can find it HERE. Click on "Skip this step" to continue:
You are done installing ((OTRS)) Community Edition. Write down the information you see on this screen as you will need it later. Copy the password so you can log in the system for the first time.
Now, click on the link to access the index page, aka, Agent Interface:
Log in using root@localhost as user and the password you wrote down from the previous step:
Once you log in you will see the Dashboard:
g) Setting up Daemon
Now that we have the database up and running correctly let's enable ((OTRS)) Community Edition's Daemon.
Execute the following commands on your virtual machine's command line:
sudo cp /opt/otrs/var/cron/otrs_daemon.dist /opt/otrs/var/cron/otrs_daemon
sudo /opt/otrs/bin/Cron.sh start otrs
And with that last step we finished installing ((OTRS)) Community Edition 5 on a CentOS7 using MariaDB database.
Comments
No comment yet.