Tuesday, January 25, 2011

Roundcube webmail суулгах

Roundcube webmail суулгах болон өмнө нь суусан вэб  мэйл дээр суулгах 2 жаахан ялгаатай гэхдээ ойролцоо. Энэ удаад ISPConfig дагалдаад суудаг squirrelmail -ийг Roundcube болгох заавар болон зарим нэг анхаарууштай зүйлүүдийг өөрийхөөрөө оруулахыг хичээлээ.

Changing From SquirrelMail To RoundCube On Your ISPConfig3 Server

Step 1.

Дараах командуудыг shell дээр бичнэ.
cd /usr/share
wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/0.3.1/roundcubemail-0.3.1.tar.gz?use_mirror=ignum
tar -vxf roundcubemail-0.3.1.tar.gz
rm -fr roundcubemail-0.3.1.tar.gz
cd roundcubemail-0.3.1
rm -fr installer
chmod 755 temp logs
cd config
cp db.inc.php.dist db.inc.php
cp main.inc.php.dist main.inc.php


Step 2.

Бааз үүсгэнэ.
Database name: roundcubedb
Database user: roundcubeuser
Database pass: 12345

Step 3.

Баазаа үүсгэсэн бол roundcube суулгасан байрлалд очиж дараах файлыг нээн баазын тохиргоог хийж өгнө. Жишээ нь:  shell дээр ~$  /usr/share/roundcubemail-0.5/config

Дараах файл нь вэб мэйлын config фолдерт байдаг.

vi db.inc.php
Энэ мөрийг олж дараах байдлаар сольно:
[...]
$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
[...]
to: энд өөрийн үүсгэсэн баазын нэр, нууц үгийг оруулна.
[...]
$rcmail_config['db_dsnw'] = 'mysql://dbuseName:dbPass@localhost/dbname'; 
[...]

Одоо дараах тохиргооны файлд тохиргоо хийнэ. main.inc.php:
vi main.inc.php
Дараах мөрүүдийг олж засна:
[...]
$rcmail_config['message_cache_lifetime'] = '10d';
[...]
$rcmail_config['default_host'] = '';
[...]
$rcmail_config['smtp_server'] = '';
[...]
$rcmail_config['session_lifetime'] = 10;
[...]
$rcmail_config['create_default_folders'] = FALSE;
[...]
to: default_host -энэ нь таны хостын нэр байна. Үүнийг буруу оруулвал вэб майл чинь IMAP сервертэйгээ холбогдохгүй.
[...]
$rcmail_config['message_cache_lifetime'] = '30m'; 
[...]
$rcmail_config['default_host'] = 'localhost';
[...]
$rcmail_config['smtp_server'] = 'localhost'; 
[...]
$rcmail_config['session_lifetime'] = 30; 
[...]
$rcmail_config['create_default_folders'] = TRUE;
[...]

Step 4.

Үүсгэсэн баазруугаа дараах бичлэгүүдийг нэмнэ. Ингээд table -үүд нь үүснэ.
Дараах файл нь SQL фолдерт байдаг. mysql.initial.sql
ЖНЬ: roundcubemail-0.3.1/SQL/mysql.initial.sql
-- RoundCube Webmail initial database structure
/*!40014  SET FOREIGN_KEY_CHECKS=0 */;
-- Table structure for table `session`
CREATE TABLE `session` (
 `sess_id` varchar(40) NOT NULL,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `ip` varchar(40) NOT NULL,
 `vars` mediumtext NOT NULL,
 PRIMARY KEY(`sess_id`),
 INDEX `changed_index` (`changed`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `users`
CREATE TABLE `users` (
 `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `username` varchar(128) NOT NULL,
 `mail_host` varchar(128) NOT NULL,
 `alias` varchar(128) NOT NULL,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `last_login` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `language` varchar(5),
 `preferences` text,
 PRIMARY KEY(`user_id`),
 INDEX `username_index` (`username`),
 INDEX `alias_index` (`alias`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `messages`
CREATE TABLE `messages` (
 `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 `del` tinyint(1) NOT NULL DEFAULT '0',
 `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `idx` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `subject` varchar(255) NOT NULL,
 `from` varchar(255) NOT NULL,
 `to` varchar(255) NOT NULL,
 `cc` varchar(255) NOT NULL,
 `date` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `size` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `headers` text NOT NULL,
 `structure` text,
 PRIMARY KEY(`message_id`),
 INDEX `created_index` (`created`),
 INDEX `index_index` (`user_id`, `cache_key`, `idx`),
 UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
 CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `cache`
CREATE TABLE `cache` (
 `cache_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL ,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `data` longtext NOT NULL,
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`cache_id`),
 INDEX `created_index` (`created`),
 INDEX `user_cache_index` (`user_id`,`cache_key`),
 CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `contacts`
CREATE TABLE `contacts` (
 `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `del` tinyint(1) NOT NULL DEFAULT '0',
 `name` varchar(128) NOT NULL,
 `email` varchar(128) NOT NULL,
 `firstname` varchar(128) NOT NULL,
 `surname` varchar(128) NOT NULL,
 `vcard` text NULL,
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`contact_id`),
 INDEX `user_contacts_index` (`user_id`,`email`),
 CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `identities`
CREATE TABLE `identities` (
 `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `del` tinyint(1) NOT NULL DEFAULT '0',
 `standard` tinyint(1) NOT NULL DEFAULT '0',
 `name` varchar(128) NOT NULL,
 `organization` varchar(128) NOT NULL DEFAULT '',
 `email` varchar(128) NOT NULL,
 `reply-to` varchar(128) NOT NULL DEFAULT '',
 `bcc` varchar(128) NOT NULL DEFAULT '',
 `signature` text,
 `html_signature` tinyint(1) NOT NULL DEFAULT '0',
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`identity_id`),
 CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
За ингээд вэб мэйл бэлэн болно. 

Step 5.

Одоо дараах өөрчлөлтийн хийгээд боллоо.
cd /usr/share
mv squirrelmail squirrelmail.bak
mv roundcubemail-0.3.1 squirrelmail

Step 6.

Finally go to http://www.yourdomain.tld:/webmail and sign in to enjoy this cute Webmail.


Goodluck

No comments:

Post a Comment