본문 바로가기

리눅스

[리눅스] iTop(itsm) 설치하기

728x90

iTop(itsm) 설치하기

 iTop - IT Service Management & CMDB

테스트 환경

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

APT 인덱스 업데이트

apt update

필수 종속성(required dependencies) 설치

apt install -y lsb-release ca-certificates apt-transport-https software-properties-common
apt install -y openssl
$ openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

mysql 설치

mysql 패키지 설치

apt install -y mysql-server mysql-client

서비스 시작 및 서비스 활성화

systemctl --now enable mysql.service
$ systemctl --now enable mysql.service
Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mysql

mysql 버전 정보 확인

/usr/sbin/mysqld --version
$ /usr/sbin/mysqld --version
/usr/sbin/mysqld  Ver 8.0.31-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

mysql 접속

mysql -uroot
$ mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.31-0ubuntu0.22.04.1 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql root 패스워드 변경

ALTER user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'rootpassword1!';
mysql> ALTER user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'rootpassword1!';
Query OK, 0 rows affected (0.02 sec)
FLUSH PRIVILEGES;
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.31-0ubuntu0.22.04.1 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

데이터베이스 생성

itop 데이터베이스 생성 및 유저 생성

CREATE DATABASE itop_db CHARACTER SET UTF8 COLLATE UTF8_BIN;
CREATE USER 'itop_user'@'%' IDENTIFIED BY 'P@ssw0rd1!';
GRANT ALL PRIVILEGES ON itop_db.* TO 'itop_user'@'%';
FLUSH PRIVILEGES;

apache 설치

apache 패키지 및  php 패키지 설치

apt install -y apache2 php8.1 libapache2-mod-php8.1 php8.1-mysql

서비스 시작 및 서비스 활성화

systemctl --now enable apache2.service
$ systemctl --now enable apache2.service
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2

apache2 버전 정보 확인

$ apache2 -v
Server version: Apache/2.4.52 (Ubuntu)
Server built:   2022-09-30T04:09:50

apache2 모듈 확인

$ apache2 -l
Compiled in modules:
  core.c
  mod_so.c
  mod_watchdog.c
  http_core.c
  mod_log_config.c
  mod_logio.c
  mod_version.c
  mod_unixd.c

아파치 모듈 활성화(ssl, rewrite)

a2enmod ssl
$ a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
  systemctl restart apache2
a2enmod rewrite
$ a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
  systemctl restart apache2

php 버전 정보 확인

$ php -v
PHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies

php 모듈 확인

$ php -m
[PHP Modules]
calendar
Core
ctype
date
exif
FFI
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

php 확장 모듈 설치

apt install -y php8.1-gd php8.1-zip php8.1-mysql php-json php8.1-xml php8.1-ldap php8.1-soap graphviz

php 모듈 확인

$ php -m
[PHP Modules]
calendar
Core
ctype
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

php.ini 파일 위치 확인

php --ini | grep "Loaded Configuration File"
$ php --ini | grep "Loaded Configuration File"
Loaded Configuration File:         /etc/php/8.1/cli/php.ini

itop 설치를 위해 php.ini 파일 편집

vim /etc/php/8.1/cli/php.ini
file_uploads = On
max_execution_time = 300
memory_limit = 256M
post_max_size = 32M
max_input_time = 60
max_input_vars = 4440
date.timezone = Asia/Seoul

또는 sed 명령으로 치환

sed -i 's/^max_execution_time = 30/max_execution_time = 300/g' /etc/php/8.1/cli/php.ini
sed -i 's/^memory_limit = -1/memory_limit = 256M/g' /etc/php/8.1/cli/php.ini
sed -i 's/^post_max_size = 8M/post_max_size = 32M/g' /etc/php/8.1/cli/php.ini
sed -i 's/^max_input_time = 60/max_input_time = 60/g' /etc/php/8.1/cli/php.ini
sed -i 's/^;max_input_vars = 1000/max_input_vars = 4440/g' /etc/php/8.1/cli/php.ini
sed -i 's/^;date.timezone =/date.timezone = Asia\/Seoul/g' /etc/php/8.1/cli/php.ini

php.ini 변경된 내용 확인

cat /etc/php/8.1/cli/php.ini | egrep '^file_uploads|^max_execution_time|^memory_limit|^post_max_size|^max_input_time|^max_input_vars|^date.timezone'
$ cat /etc/php/8.1/cli/php.ini | egrep '^file_uploads|^max_execution_time|^memory_limit|^post_max_size|^max_input_time|^max_input_vars|^date.timezone'
max_execution_time = 300
max_input_time = 60
max_input_vars = 4440
memory_limit = 256M
post_max_size = 32M
file_uploads = On
date.timezone = Asia/Seoul
service apache2 restart
service apache2 status

itop 소스 설치

itop 다운로드

https://sourceforge.net/projects/itop/

cd /usr/local/src
wget wget https://ufpr.dl.sourceforge.net/project/itop/itop/3.0.2-1/iTop-3.0.2-1-9957.zip
unzip iTop-3.0.2-1-9957.zip

DocumentRoot 디렉터리 확인

vim /etc/apache2/sites-enabled/000-default.conf
DocumentRoot /var/www/html
rsync -az web/* /var/www/html
cd /var/www/html
mkdir env-production env-production-build
chown -R www-data.www-data *

웹 브라우저 : http://192.168.0.61/index.php

추가로 php 모듈 설치

apt install -y php8.1-mbstring php8.1-curl

 - iTop Security best practice : https://www.itophub.io/wiki/page?id=3_0_0%3Ainstall%3Asecurity#secure_critical_directories_access

 - php : https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure

php(php.ini) 설정 변경

sed -i 's/^session.cookie_httponly =/session.cookie_httponly = 1/g' /etc/php/8.1/cli/php.ini
sed -i 's/^;session.cookie_secure =/session.cookie_secure = 0/g' /etc/php/8.1/cli/php.ini

서비스 재시작

systemctl restart apache2

웹 브라우저 : http://192.168.0.61/index.php

프로덕션 환경은 "I am installing a production instance, create an empty database to start from." 선택

 

 

참고URL

- itop(itsm) install : https://scbyun.com/564

 

728x90