Everyone needs a ticket system, right?
Disclaimer or Scope/Intention
This is how I did it. Short guide, more or less for myself so I won’t forget.
If Linux/Ubuntu/Apache/SSL-certs is new territory for you this isn’t the guide you were looking for, sorry. Some steps and detailed explanations are omitted.
Also never run cmds you don’t trust and know what they do.
What I used
Machine: VM in Vmware vSphere, 1vCPU, 2GB RAM, 40GB disk.
OS: Ubuntu Server 20.04 LTS Free OpenSource (https://ubuntu.com/download/server)
WebApp: osTicket 1.15.4 Free OpenSource (https://osticket.com/download/)
SSL cert: I used Let’s Encrypt for my cert and key.
Preparation
I downloaded the software from Ubuntu and osTicket. Spun up a small VM and installed Ubuntu Server on it. Performed some housekeeping on the machine.
Step 1: Install LAMP Stack (Linux, Apache, MySQL, and PHP)
On the newly setup Ubuntu machine install LAMP Stack and some extra pieces.
sudo apt install tasksel
sudo tasksel install lamp-server
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc
Sudo apt install php-imap
Sudo phpenmod imap
Step 2: Configure Domain and Apache
-Setup DNS
Go to your web domain registrar and create A record pointing to your new server. Or your DNS-resolver if you only will access the system from your homelab or LAN.
-Configure Apache conf for website
sudo cd /etc/apache2/sites-available
sudo nano example.com.conf
Paste into editor:
<Directory /var/www/example.com>
Require all granted
</Directory>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Close and save. Ctrl+X, Y, Enter
-Create folder for webpage content, enable the website and restart Apache.
sudo mkdir -p /var/www/example.com
sudo a2dissite 000-default.conf
sudo a2ensite example.com.conf
sudo systemctl reload apache2
Step 3: Prep Database
-Create database and database-user, set secure password.
sudo mysql -u root
> CREATE DATABASE osTicket;
> CREATE USER 'osticketuser' IDENTIFIED BY 'password';
> GRANT ALL ON osTicket.* TO 'osticketuser';
> quit
mysql_secure_installation
Step 4: Upload osTicket an configure
UnZip the file you downloaded from osticket.com.
Upload the contents of the “upload” folder to your website folder on the server “/var/www/example.com”.
From a web browser go to http://example.com/setup and follow the onscreen instructions. More commands and you’ll need the database-user credentials.
After setup is complete you can start setting it up as you like.
Tip: If you configure mail-fetcher add line in crontab.
nano /etc/crontab
Paste into editor:
*/5 * * * * www-data /usr/bin/php /var/www/example.com/api/cron.php
Close and save. Ctrl+X, Y, Enter
Step 5: Get SSL cert and key
All websites should use https now when there’s free and easy services like Let’s Encrypt (https://letsencrypt.org) or Cloudflare (https://cloudflare.com). There are good guides on their webpages and also a lot of specific howtos to find elsewhere. This is out of scope for this guide.
Get your cert and key from source of your choosing.
Step 6: Copy Cert and Key to Server
Create a new directory where yout Cert and Key will reside.
sudo mkdir-p /etc/letsencrypt/
Using nano text editor, create a new file example.com.pem (where example.com is your own domain).
sudo nano/etc/letsencrypt/example.com.pem
Now paste in your Origin Certificate. Save file and exit. (Press CTRL + X, press Y and then press ENTER).
Create a new file example.com.key (where example.com is your own domain).
sudo nano/etc/letsencrypt/example.com.key
Paste in your Private Key. Save file and exit. (Press CTRL + X, press Y and then press ENTER).
Step 7: Configure Apache for https
Firstly, make sure you have the SSL module enabled for Apache by running:
sudo a2enmod ssl
Open the Apache configuration file for your domain.
sudo nano/etc/apache2/sites-available/example.com.conf
You need to add a new block underneath for SSL port 443. You can also add a rewrite condition in your port 80 block to redirect all requests to https. Paste example and modify for your domain.
<Directory /var/www/example.com>
Require all granted
</Directory>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ReWriteEngine on
ReWriteCond %{SERVER_NAME} =example.com
ReWriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/example.com.pem
SSLCertificateKeyFile /etc/letsencrypt/example.com.key
</VirtualHost>
Save file and exit. (Press CTRL + X, press Y and then press ENTER).
Enable the RewriteEngine.
sudo a2enmod rewrite
Test the configuration syntax for errors.
sudo apachectl configtest
You can ignore any errors that say Could not reliably determine the server’s fully qualified domain name.
If you see Syntax OK, restart Apache.
sudosystemctl restart apache2
Done. Now you have your own ticket system to handle and keep track of everything your other personality is doing =).
Tip: Piss them of by rejecting their Change Requests, just for the fun of it.