Article

  • 2 years

    1 year

    YetiShare / Core

    3038

Setup New Server with Nginx/PHP/MySQL, Install YetiShare, Migrate Data (CentOS 6)

This document details the notes we use for installing a YetiShare on a new 64 bit CentOS 6 server. Feel free to use it for configuring your own servers in preparation of installing YetiShare.

Setup Nginx, PHP, MySQL etc:

Use the following guide to get the core applications configured.

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-6

Upgrade PHP using Remi - http://superuser.com/questions/615401/upgrading-php-5-3-3-to-5-4-4-in-centos-6-4

Install PHP Modules & Other Useful Apps:

# yum install mlocate php-gd php-curl php-mcrypt unzip zip php-cli curl php-soap php-mbstring php-xml
# updatedb
Restart Nginx and PHP:

# service nginx restart
# service php-fpm restart

MySQL Create Database & User:

Replace '[REPLACE_WITH_PASSWORD]' with a new random database password. Recommended to be at least 12 characters in length.

Login to MySQL as root.

# mysql -uroot -p
Input your root password you set earlier.

> create database yetidata;
> grant usage on *.* to [email protected] identified by '[REPLACE_WITH_PASSWORD]';
> grant all privileges on yetidata.* to [email protected];
> exit;

Install YetiShare:

You should now be set to install YetiShare. Upload the latest zip release code into your webroot (normally /usr/share/nginx/html/) using WinSCP or similar. Unzip via SSH like this: (replace YetiShare_v4.1.1.zip with the zip filename)

# unzip YetiShare_v4.1.1.zip
Delete YetiShare_v4.1.1.zip:

# unlink YetiShare_v4.1.1.zip
Point your web browser to the script installer and follow the instruction onscreen.

http://yoursite.com/install/
Nginx rewrite rules for YetiShare will also need set. These can be found in the file called '___NGINX_RULES.txt' in the root of the zip download. Apply these to the Nginx config file:

# nano /etc/nginx/conf.d/default.conf
Restart Nginx after the changes:

# service nginx restart
Copy your main site files to a file server using rsync. Useful during upgrades, update your main site code and with any new plugins then run this to push the changes over to each file server. Replace the fs1.yourdomain.com and server paths. Run it via SSH on your main server.

# rsync -avh --exclude 'files/*' --exclude 'core/logs/*' --exclude 'core/cache/*' --exclude '___OLD_SITE/*' --exclude '_config.inc.php' /home/www/ [email protected]:/home/www

Important Information to Note:

Restart MySQL: service mysqld restart
Restart Nginx: service nginx restart
Restart PHP: service php-fpm restart
PHP Config: /etc/php.ini
MySQL Config: /etc/my.cnf
Nginx Main Site Config: /etc/nginx/conf.d/default.conf

Performance:

After you've installed YetiShare you can tweak the server settings for better performance. See our other knowledge base article here:

https://support.mfscripts.com/public/kb_view/27/

Note: After any server config changes ensure you restart Nginx, MySQL & PHP (commands above).


Useful Commands:

Dump Database Tables to File Example:

# mysqldump -udatabase_user -p database_name > /root/db.sql
Send SQL File to Remote Server:

# rsync -avh /root/db.sql [email protected]:/root/db.sql
Import SQL File:

# mysql -udatabase_user -p database_name < /root/db.sql

Rsync Files:

# rsync -avh /usr/share/nginx/html/ [email protected]:/usr/share/nginx/html
(custom port: rsync -avh --rsh='ssh -p21088' /usr/share/nginx/html/ [email protected]:/usr/share/nginx/html/)

Set File/Folder Permissions:

# chmod -R 755 /usr/share/nginx/html/files/

If CHMOD 777 isn't working, disable selinux:

echo 0 > /selinux/enforce



Useful Resources:


https://clasense4.wordpress.com/2015/02/26/how-toinstall-php-fpm-on-linux-centos-6-5-6-6/