Skip to content

Install on CentOS (6.x | 7.x)

Install MailCarry on CentOS VPS

Step 1: Install Apache2

yum -y install httpd

service httpd start

You need to open port 80 to make your web server accessible:

/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT

Step 2: Install PHP 7.2 and Related Modules

To install PHP and related modules run the commands below

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install yum-utils if it is not already installed.
yum install yum-utils

Enable the Remo repository for PHP 7.2:

#CentOS 6
sudo yum install epel-release yum-utils
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm
#CentOS 7
sudo yum install epel-release yum-utils
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum-config-manager --enable remi-php72

yum install php72 php72-php-fpm php72-php-mysqlnd php72-php-opcache php72-php-xmlrpc php72-php-json

This will install PHP 7.2 as well as other commonly used PHP extensions. To verify PHP 7.2 is successfully installed, run the following command:

php72 -v

Create a symbolic link to /usr/bin/php

ln -s /usr/bin/php72 /usr/bin/php

Verify again

php -v

Install PHP libraries that will be used for the MailCarry:

yum install mod_php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-xml php-mbstring php-imap

If index.php not working

Open /etc/httpd/conf/httpd.conf

Add index.php before index.html and save

<IfModule dir_module>

    DirectoryIndex index.php index.html

</IfModule>

Step 3: Enable .htaccess file

Open

/etc/httpd/conf/httpd.conf

Replace (within <Directory “/var/www/html”> )

AllowOverride None to  AllowOverride All

Restart Apache

service httpd restart

Step 4: Install MySQL

sudo yum install wget

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm

sudo yum install mysql-server

// if any issue regarding key etc, then:

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

Starting MySQL

sudo systemctl start mysqld

During the installation process, a temporary password is generated for the MySQL root user. Locate it in the mysqld.log with this command:

sudo grep 'temporary password' /var/log/mysqld.log

Use this command to run the security script.

sudo mysql_secure_installation

This will prompt you for the default root password. As soon as you enter it, you will be required to change it.

Output

The existing password for the user account root has expired. Please set a new password.

New password:

Then log into mysql

mysql -u root -p

Enter the password you recently set for root user

Create MySQL user

CREATE USER 'mailcarry'@'localhost' IDENTIFIED BY 'M@ilC@rry123';

where “mailcarry” is the username and “M@ilc@arry123” is the password

GRANT ALL ON mailcarry.* TO 'mailcarry'@'localhost';

FLUSH PRIVILEGES;

Step 5: Upload MailCarry files on the server

Upload all the extracted files from MailCarry.[VERSION-NUMBER].zip to the location, eg:

/var/www/html

Step 6: Set Permissions

Set the permission for the following file and folders

  • chmod 777 -R /var/www/html/.env
  • chmod 777 -R /var/www/html/storage/
  • chmod 777 -R /var/www/html/bootstrap/cache/

Step 7: Now Access the Install URL

[YOUR-INSTALLED-URL]/install/
eg: If https://mailcarry.com is the domian then https://mailcarry.com/install/

  • Fill the data as per your requirement
  • Click Install

Install cron

yum install cronie

Now, we’ll edit the crontab.

crontab -e

Set the required cron

  1. press esc.
  2. press i (for “insert”) to begin editing the file.
  3. paste the cron command in the file.
    • * * * * * /usr/bin/php /var/www/html/artisan schedule:run >/dev/null 2>&1
  4. press esc again to exit editing mode.
  5. type :wq to save (w – write) and exit (q – quit) the file.


Cron command may vary according to the php path and files path.
After succcessfull installation MailCarry will show you the required command.

Hurrah! You have done it.

Was this article helpful?
How can we improve this article?
Table of Contents

Copyright © 2020 MailCarry