Giới Thiệu
osTicket là một hệ thống quản lý vé hỗ trợ khách hàng mã nguồn mở, giúp bạn quản lý các yêu cầu hỗ trợ từ khách hàng một cách hiệu quả. Bài viết này sẽ hướng dẫn bạn cách cài đặt và cấu hình osTicket trên server Ubuntu 24.04.
Bước 1: Cập Nhật Hệ Thống
Trước tiên, hãy cập nhật hệ thống của bạn để đảm bảo tất cả các gói phần mềm đều ở phiên bản mới nhất:
root@osticket:~#sudo apt update && sudo apt upgrade -y full-upgrade
root@osticket:~#[-f /var/run/reboot-required]&& sudo reboot -f
Bạn nên đặt tên máy chủ(Tùy chọn):
root@osticket:~# sudo hostnamectl set-hostname osticket.hanhphuchospital.com
Chỉnh sửa tệp /etc/hosts và thêm tên máy chủ thành địa chỉ IP
root@osticket:~# sudo vim /etc/hosts
10.10.98.143 osticket.hanhphuchospital.com (Thêm dòng này vào trong file hosts, nhớ tùy chỉnh theo mô hình của bạn nhé).
Bước 2: Cài Đặt SQL MariaDB.
root@osticket:~# sudo apt -y update
root@osticket:~# sudo apt install mariadb-server -y
root@osticket:~# sudo mysql_secure_installation (cân nhắc tùy chọn như bên dưới).
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
haven't set the root password yet, you should just press
enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper
authorisation.
You already have your root account protected, so you can
safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, 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!
Bước 3: Tạo Cơ Sở Dữ Liệu cho osTicket
Đăng nhập vào MySQL và tạo cơ sở dữ liệu và người dùng cho osTicket:
root@osticket:~# sudo mysql -u root -pEnter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 10.11.8-MariaDB-0ubuntu0.24.04.1 Ubuntu 24.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Trong MySQL shell, chạy các lệnh sau: MariaDB [(none)]> CREATE DATABASE osticket_db;MariaDB [(none)]> GRANT ALL PRIVILEGES ON osticket_db.* TO osticket_user@localhost IDENTIFIED BY "Str0ngDBP@ssw0rd";MariaDB [(none)]> FLUSH PRIVILEGES;MariaDB [(none)]> QUIT;Bước 4: Cài Đặt máy chủ Web Apache.
Trên Ubuntu, bạn có thể cài đặt máy chủ Web Apache từ kho lưu trữ apt chính thức:
root@osticket:~# sudo apt install apache2 -y
Để bắt đầu dịch vụ theo cách thủ công, hãy chạy:
|
root@osticket:~# sudo systemctl start apache2 |
Mặc dù dịch vụ được bật để khởi động khi khởi động theo mặc định, nhưng việc cho phép dịch vụ này theo cách thủ công thì bạn phải chạy:
root@osticket:~# sudo systemctl enable apache2
Bước 5: Tải và Cài Đặt PHP 8.2
Để cài đặt PHP 8.2 và các tiện ích mở rộng cần thiết trên Ubuntu, bạn có thể làm theo các bước sau:
Bước 5.1: Thêm kho lưu trữ PHP PPA
root@osticket:~# sudo apt update
root@osticket:~# sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
root@osticket:~# sudo add-apt-repository ppa:ondrej/php
Bước 5.2: Cài đặt PHP 8.2 và các tiện ích mở rộng
root@osticket:~# sudo apt install php8.2 php8.2-common -y
root@osticket:~# sudo apt install php8.2-imap php8.2-apcu php8.2-intl php8.2-cgi php8.2-mbstring php8.2-gd php8.2-mysql php8.2-bcmath php8.2-xml -y
Bước 5.3: Kiểm tra phiên bản PHP đã cài đặt
Sau khi hoàn tất, bạn có thể kiểm tra phiên bản PHP đã cài đặt bằng lệnh php -v. Nếu bạn cần thêm sự trợ giúp hoặc có câu hỏi khác, hãy cho tôi biết nhé!
root@osticket:~# php -v
PHP 8.2.21 (cli) (built: Jul 4 2024 16:26:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.21, Copyright (c) Zend Technologies
with Zend OPcache v8.2.21, Copyright (c),
by Zend Technologies
Bước 6: Tải và Cài Đặt osTicket
Cài đặt các công cụ cần thiết để tải phần mềm:
root@osticket:~# sudo apt install curl wget unzip -yTải phiên bản mới nhất của osTicket:
root@osticket:~# curl -s https://api.github.com/repos/osTicket/osTicket/releases/latest|grep browser_download_url| cut -d '"' -f 4 | wget -i -Trích xuất kho lưu trữ đã tải xuống:
root@osticket:~# unzip osTicket-v*.zip -d osTicketSau khi giải nén bạn sẽ nhận được hai thư mục: scripts và upload
root@osticket:~# ls osTicket
scripts uploadTạo thư mục web cho osTicket và mv những thư mục này vào đó.
root@osticket:~# sudo mv osTicket /var/www/Tiếp theo tạo tệp cấu hình osTicket:
root@osticket:~# cd /var/www/osTicket/upload/includesudo cp ost-sampleconfig.php ost-config.php
Thay đổi quyền sở hữu thư mục web osTicket thành người dùng www-data và nhóm.
sudo chown -R www-data:www-data /var/www/Vô hiệu hóa trang web Apache mặc định:
sudo a2dissite 000-default.conf
sudo rm /var/www/html/index.html
sudo systemctl restart apache2Bước 7: Hoàn Tất Cài Đặt Qua Trình Duyệt
Tạo tệp cấu hình VirtualHost cho osTicket trên thư mục cấu hình Apache:root@osticket:~# sudo vim /etc/apache2/sites-available/osticket.confThêm nội dung:
<VirtualHost *:80>
ServerAdmin [email
DocumentRoot /var/www/osTicket/upload
ServerName osticket.hanhphuchospital.com
ServerAlias www.osticket.hanhphuchospital.com
<Directory /var/www/osTicket/>
Options FollowSymlinks
AllowOverride
All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/osticket_error.log
CustomLog ${APACHE_LOG_DIR}/osticket_access.log combined
</VirtualHost>
Thay thế :
- osticket.hanhphuchospital.com bằng tên miền của bạn.
- /var/www/osTicket/upload với đường dẫn tới tệp osTicket của bạn.
Kích hoạt trang web sau khi thay đổi
root@osticket:~# sudo a2ensite osticket.conf sudo systemctl restart apache2Xác nhận cú pháp cấu hình:
root@osticket:~# sudo apachectl -t
Syntax OKKhởi động lại Apache2:
root@osticket:~# sudo systemctl restart apache2Bước 8: Hoàn Tất Cài Đặt Qua Trình Duyệt
Mở trình duyệt và truy cập vào địa chỉ:
http://10.10.98.143 or http://osticket.hanhphuchospital.com để hoàn tất cài đặt osTicket. Nhập thông tin cơ sở dữ liệu và cấu hình quản trị viên theo yêu cầu.
Hãy lưu ý tất cả các URL truy cập của bạn. Để đăng nhập vào hệ thống phụ trợ ( Staff control panel), hãy sử dụng domain.com/scp
Bước 9: Bảo Mật osTicket
domain.com/scp Sau khi cài đặt xong,bây giờ hãy thay đổi quyền của tệp ost-config.php để xóa quyền cấu hình để bảo mật:
sudo chmod 0644 /var/www/osticket/upload/include/ost-config.phpNgoài ra, hãy xóa thư mục cài đặt:
sudo rm -rf /var/www/osTicket/upload/setup/Kết Luận
Chúng ta cần chỉnh sửa giao diện, background, logo, setup mail, đồng bộ mail..v.v., để sử dụng tốt nhất có thể. Mình sẽ có các bài hướng dẫn sau.















Không có nhận xét nào:
Đăng nhận xét