Last active
January 3, 2016 14:29
-
-
Save chicks/8476722 to your computer and use it in GitHub Desktop.
Sugar and Percona MySQL on CentOS 6.5 w/ PHP 5.4, ElasticSearch, and Memcache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Guide for Sugar on CentOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculate MySQL Database Size | |
cd /var/lib/mysql ; du -ks * | |
# Turn on Page Load Timings for Sugar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable SELinux | |
echo 0 > /selinux/enforce | |
perl -pi -e 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config | |
# Disable IPTables | |
chkconfig iptables off | |
service iptables stop | |
# Uninstall PHP, Apache, etc... | |
yum remove php* | |
yum remove mysql* | |
# Clean things up | |
yum clean all | |
yum update | |
# Make sure we have SSH clients (i.e. SCP), and basic archive utils | |
yum -y install openssh-clients unzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add Percona Repo | |
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm | |
# Install Percona Client and Server | |
yum -y install Percona-Server-client-55 Percona-Server-server-55 Percona-Server-shared-compat | |
# Update DB Config | |
# File Per Table | |
# perl -pi -e 's/(\[mysqld\])/\1\ninnodb_file_per_table\n/g' /etc/my.cnf | |
# Barracuda | |
# BufferPool Size | |
# BufferPool Instances | |
# DB Max Connections | |
# DB Max User Connections | |
# binlog_format = extlookup('percona_binlog_format', 'MIXED' | |
# Turn on MySQL at boot | |
chkconfig mysql on | |
# Start it up | |
service mysql start | |
# Set Root Password | |
pass='letmein' | |
mysqladmin -u root password $pass | |
# Save password for root | |
echo -e "[client]\npassword=$pass" > ~/.my.cnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Package | |
yum -y install memcached | |
# Update Config, increase cache size and max connections | |
perl -pi -e 's/MAXCONN="1024"/MAXCONN="4096"/g' /etc/sysconfig/memcached | |
perl -pi -e 's/CACHESIZE="64"/CACHESIZE="256"/g' /etc/sysconfig/memcached | |
# Enable at Boot | |
chkconfig memcached on | |
# Start | |
service memcached start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Increase File Descriptors | |
sysctl -w fs.file-max=100000 | |
echo -e "\n# Increase global file descriptor limit\nfs.file-max = 100000\n" >> /etc/sysctl.conf | |
# Install Java and CURL | |
yum -y install java-1.7.0-openjdk curl | |
# Install Package | |
yum -y localinstall https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.noarch.rpm | |
# Update config | |
# Lock memory so we don't thrash... | |
perl -pi -e 's/# bootstrap.mlockall: true/bootstrap.mlockall: true/g' /etc/elasticsearch/elasticsearch.yml | |
# Prevent destructive wildcard operations | |
echo "action.disable_close_all_indices: true" >> /etc/elasticsearch/elasticsearch.yml | |
# Prevent remote deletion of indexes | |
echo "action.disable_delete_all_indices: true" >> /etc/elasticsearch/elasticsearch.yml | |
# Turn off remote shutdown | |
echo "action.disable_shutdown: true" >> /etc/elasticsearch/elasticsearch.yml | |
# Enable on boot | |
chkconfig elasticsearch on | |
# Start the server | |
service elasticsearch start | |
# Check the server | |
curl -X GET http://localhost:9200/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install EPEL and REMI Repo's | |
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm | |
# Install PCRE Headers (required for APC) | |
yum -y install pcre-devel | |
# Install Apache and PHP 5.4 | |
yum --enablerepo=remi -y install httpd mod_ssl mod_php php php-apc php-devel php-gd php-pear php-mbstring php-imap php-bcmath php-pecl-memcached php-mysql | |
# Update PHP.ini | |
perl -pi -e 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php.ini | |
perl -pi -e 's/;error_log = syslog/error_log = \/var\/log\/httpd\/php_error\.log/g' /etc/php.ini | |
perl -pi -e 's/;date.timezone =/date.timezone = UTC/g' /etc/php.ini | |
perl -pi -e 's/upload_max_filesize = 2M/upload_max_filesize = 100M/g' /etc/php.ini | |
# Update apc.ini to increase APC SHM Size | |
perl -pi -e 's/apc.shm_size=64M/apc.shm_size=256M/g' /etc/php.d/apc.ini | |
# Update memcached.ini so PHP Stores sessions in Memcache instead of local disk | |
perl -pi -e 's/;session.save_handler=memcached/session.save_handler=memcached/g' /etc/php.d/memcached.ini | |
perl -pi -e 's/;session.save_path="localhost:11211"/session.save_path="localhost:11211"/g' /etc/php.d/memcached.ini | |
# Update php.ini for Apache so PHP stores sessions in memcache instead of local disk | |
perl -pi -e 's/php_value session.save_handler "files"/php_value session.save_handler "memcached"/g' /etc/httpd/conf.d/php.conf | |
perl -pi -e 's/php_value session.save_path "\/var\/lib\/php\/session"/php_value session.save_path "localhost:11211"/g' /etc/httpd/conf.d/php.conf | |
# Set permissions on logfile | |
touch /var/log/httpd/php_error.log | |
chmod 664 /var/log/httpd/php_error.log | |
# Create a phpinfo file | |
echo -e "<?php\nphpinfo();\n?>" > /var/www/html/info.php | |
# Turn on Apache | |
chkconfig httpd on | |
service httpd start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is optional, and requires a newrelic account. Visit http://newrelic.com to sign up. | |
# Install NewRelic Repo | |
rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm | |
# Install Server Agent | |
yum install newrelic-sysmond | |
# Configure Agent | |
nrsysmond-config --set license_key=YOUR_LICENSE_KEY | |
# Enable Agent on boot | |
chkconfig newrelic-sysmond on | |
# Start Agent | |
service newrelic-sysmond start | |
# Install PHP Agent | |
yum -y install newrelic-php5 | |
# Run the installation script | |
newrelic-install install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install EPEL Repo if not already installed | |
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
# Install collectd, and apache and mysql plugins | |
yum -y install collectd collectd-apache collectd-mysql | |
# Enable at boot | |
chkconfig collectd on | |
# Start Server | |
service collectd start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unpack everything into /var/www/html | |
unzip SugarEnt-6.5.16.zip -d /var/www/html/ | |
# Move Sugar into the root dir | |
mv /var/www/html/SugarEnt-Full-6.5.16/* /var/www/html/ | |
mv /var/www/html/SugarEnt-Full-6.5.16/.htaccess /var/www/html | |
# Clean up | |
rm -rf /var/www/html/SugarEnt-Full-6.5.16 | |
# Change into that dir | |
cd /var/www/html | |
# Update Permissions | |
chown -R apache:apache * | |
chown -R apache:apache .htaccess | |
# If you installed NewRelic, add instrumentaiton settings to config_override.php | |
$sugar_config['external_cache_disabled_memcache'] = true; // Disables Memcache | |
$sugar_config['external_cache_disabled_apc'] = true; // Disables Memcache | |
$sugar_config['metric_providers'] = array('SugarMetric_Provider_Newrelic' => 'include/SugarMetric/Provider/Newrelic.php'); | |
$sugar_config['metric_settings'] = array('SugarMetric_Provider_Newrelic' => array ('applicationname' => 'Sugar_715')); | |
$sugar_config['metrics_enabled'] = 1; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a real MySQL config file | |
# Check apache file configuration | |
# Convert to file per table | |
# Check Permissions on Apache, PHP, and MySQL Directories | |
# Calculate memory allocations for MySQL, Memcache, Apache, and Elasticsearch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment