리눅스

[Linux] CentOS7 Roundcube 메일서버 설치

화이트해커 Luna 🌙 2023. 1. 16. 11:46
728x90
반응형

CentOS7 RoundMAil서버 설치

 

roundcube 메일서버는 웹서버에 추가하여 사용하는 어플리케이션이다.

 

-목차-
1. 패키지 설치
2. PHP 연동 확인
3. 어플리케이션 설치
4. roundcube 초기설정
5. 웹서버에 추가
6. Test Config

 


1. 패키지 설치

 

 요구 패키지

http, mysql-server(mariadb-server), php

php-mysqlnd, php-gd, php-mbstring,
php-pecl-zip, php-json, php-intl,
php-pecl-imagick, php-ldap, php-xml

 

yum install 명령어
[root@ns1 ~]# yum install php74-php php74-php-mysqlnd php74-php-gd php74-php-pecl-zip php74-php-mbstring php74-php-json php74-php-intl php74-php-pecl-imagick php74-php-ldap php74-php-xml
[root@ns1 ~]# rpm -qa | grep php74-php | wc -l
14

 

2. PHP 연동 확인

 

# cat > /var/www/html/index.php
    <?php phpinfo(); ?>
    
# systemctl restart httpd
# systemctl enable  httpd
# firewall-cmd --add-port=80/tcp --permanent
# firewall-cmd --reload

 

 Windows의 Web Browser를 이용하여 접속하여 확인한다.

 


3. 어플리케이션 설치

 

# cd /var/www/html
# tar zxf roundcubemail-1.6.0-complete.tar.gz
# ls -lh
drwxr-xr-x. 13  501   80 4.0K  7월 24 05:17 roundcubemail-1.6.0
-rw-rw-rw-.  1 root root 5.7M  1월  6 09:21 roundcubemail-1.6.0-complete.tar.gz
# mv roundcubemail-1.6.0 mail
# chown -R apache:apache mail
# ls -lh
drwxr-xr-x. 13 apache apache 4.0K  7월 24 05:17 mail
-rw-rw-rw-.  1 root   root   5.7M  1월  6 09:21 roundcubemail-1.6.0-complete.tar.gz
# systemctl restart httpd

 

roundcube 메일 어플리케이션 설치파일을 다운로드 받아 압축을 풀고, 풀린 디렉토리를 /var/www/html 디렉토리 아래에 적절한 이름으로 이동시킨다. 디렉토리의 소유주/그룹을 apache로 변경하고 웹데몬(httpd)를 다시 구동시킨다.

 


4. roundcube 초기설정

Web Browser를 이용하여 'http://도메인/mail/installer' 로 접속한다.

 

Roundcube Webmail Installer 페이지에서 요구하는 내용들을 충족하는지 확인
Checking available databases는 접속할 DataBase인 MySQL(MariaDB)만 확인하면 된다.

 

Dababase setup에서 연동할 데이터베이스 서버 정보를 입력
IMAP Settings에서 연동할 IMAP 서버 정보 입력
SMTP Settings에서 연동할 STMP 서버 정보 입력
smtp_host : localhost:25
smtp_user : ''
smtp_pass : ''
Use the current IMAP username...: uncheck

 

SMTP는 웹서버에서 직접 발송한다.

# yum install sendmail
# systemctl restart sendmail
# systemctl enable  sendmail

 

Display settings & user prefs
language : ko_KR


CREATE CONFIG 클릭


5. 웹서버에 추가

 

출력된 설정내용을 웹서버에 config.inc.php 파일을 만들어서 추가한다.

 

# touch /var/www/html/mail/config/config.inc.php
# chown apache:apache /var/www/html/mail/config/config.inc.php
# vi /var/www/html/mail/config/config.inc.php
      1<?php
      2/* Local configuration for Roundcube Webmail */

     37 $config['imap_host'] = 'mail.ajd.go.ki:143';
     38
     39 // ----------------------------------
     40 // IMAP
     41 // ----------------------------------
     42 $config['smtp_host'] = 'localhost:25';
     43 $config['smtp_user'] = '';
     44 $config['smtp_pass'] = '';

 


6. Test Config

 

모든 설정이 완료되면, Test Config을 진행한다.

 

Check if directories are writable
Roundcube may need to write/save files into these directories
/var/www/html/mail/temp/:  NOT OK
/var/www/html/mail/logs/:  NOT OK

 

 temp, logs 디렉토리의 소유주가 apache계정이라면,
    # setsebool httpd_unified on

 

 temp, logs 디렉토리의 소유주가 apache계정이 아니라면,
    # chmod o+w temp
    # chmod o+w logs
    # setsebool httpd_unified on

 

   Test SMTP config
    # setsebool httpd_can_sendmail on     
    #이후에 테스트 진행

 

   Test IMAP config

     그냥 진행


 

728x90
반응형