How To Setup osTicket

From Linux Delta
Jump to: navigation, search

How to Setup a OSTICKET on Centos 7

Author: Chris DeLuca

Overview The following guide will walk you through how to setup OSTicket on a CentOS 7 box. Keep in mind CentOS 7 goes EOL June 30 2024. This guide was written by me after many trail and error setups to get it running. I also use nano for my editing.

System Requirements

An up to date CentOS 7 install.

Step-By-Step Guide

Step 1: Install neccessary repos and packages. We need at least php 5.6 so I enable remi-php56 repos as well.

sudo yum -y install epel-release
sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum install -y yum-utils
sudo yum-config-manager --enable remi-php56
sudo yum -y install firewalld mariadb mariadb-server httpd php unzip php-mysql php-imap php-xml php-mbstring php-pecl-apcu php-pecl-zendopcache php-intl php-gd nano wget

Step 2: Start and enable the firewall and Apache services.

sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo systemctl start httpd
sudo systemctl enable httpd

Step 3: Allow ports 80 and 443 though the firewall and restart service.

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload

Step 4: Set SELinux to permissive:

sudo setenforce 0

Step 5: Set SELinux to permissive permanetly by editing config for SELinux

Open /etc/selinux/config and change enforcing to permissive and save file.

sudo nano /etc/selinux/config

Step 6: Go to https://osticket.com/download/ and pick the version you would like to install.

I picked osTicket Core, v1.12.5 (next page) English language (next page) Authentication :: HTTP Pass-through (next page) Fill out or skip the information page and the file starts downloading to your computer. At which point I will sftp copy it to the server I am going to install it on.

Step 6: Unzip, copy and assign permissions.

unzip osTicket-vX.XX.zip
sudo cp -rp upload /var/www/html/helpdesk
sudo chown -R apache:apache /var/www/html/helpdesk
cd /var/www/html/helpdesk
sudo cp include/ost-sampleconfig.php include/ost-config.php
sudo chmod 0666 include/ost-config.php

Step 7: At this point if you navigate to http://ipaddress/helpdesk you should see the webpage.

Click Continue if everything is good.

Step 8: Start Database

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 9: Set database root password.

mysqladmin --user=root password "newpassword"

Step 10: Secure DB.

sudo mysql_secure_installation

 Example:
localhost:# mysql_secure_installation 


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.


You already have a root password set, so you can safely answer 'n'.


Change the root password? [Y/n] n
 ... skipping. 


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!

Step 11: Create database and user for osticket: Note: mysql> lines are after being connected to MariaDB only copy after the > if you are going to copy and past commands.

mysql -uroot -p
mysql> CREATE DATABASE ost;
mysql> CREATE USER 'ostusr'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON ost.* TO "ostusr"@"localhost" IDENTIFIED BY "password";
mysql> FLUSH PRIVILEGES;
mysql> exit

Step 12:

Fill out the form on the page you browsed to earlier in step 7 be sure to type ostusr and not make the mistake I did and typed ostuser.
Click Install now at the bottom of the page.


Congratulations you have installed osTicket. There is a bit of cleanup left to do.

Step 13:

Change permission of ost-config.php to remove write access.
 sudo chmod 0644 include/ost-config.php

Step 14:

You can now log into your osTicket install from http://yourIP/helpdesk  
Please note you need to click "I'm an agent - sign in here" on the right pane to access the backend with your admin user.