Skip to content

Instantly share code, notes, and snippets.

@m0n5t3r
Last active December 16, 2015 07:50
Show Gist options
  • Save m0n5t3r/83b389de044573d3773b to your computer and use it in GitHub Desktop.
Save m0n5t3r/83b389de044573d3773b to your computer and use it in GitHub Desktop.
script to install Magento-related essentials on Ubuntu 14.04 servers without puppet
#!/bin/bash
# percona repo
echo 'deb http://repo.percona.com/apt trusty main
deb-src http://repo.percona.com/apt trusty main
' > /etc/apt/sources.list.d/percona.list
apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 1C4CBDCDCD2EFD2A
# varnish repo
echo 'deb http://repo.varnish-cache.org/ubuntu/ trusty varnish-3.0' > /etc/apt/sources.list.d/varnish.list
apt-key adv --keyserver pool.sks-keyservers.net --recv-keys C4DEFFEB
# base packages
aptitude install htop atop mc unattended-upgrades vim-nox vim-addon-manager tmpreaper python-software-properties software-properties-common nmon iotop pv ntp sysfsutils smartmontools moreutils
add-apt-repository ppa:iacobs/redis
aptitude update
# no moar tmpreaper warning
sed -i -e 's/SHOWWARNING/#&/g' /etc/tmpreaper.conf
mkdir -p /etc/mysql
# mysql config, so the db gets created with properly sized log files
cat >/etc/mysql/my.cnf <<__EOF__
[mysqld]
skip-external-locking
key_buffer_size = 64M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
max_connections = 400
query_cache_type = 1
query_cache_limit = 16M
query_cache_size = 128M
general_log_file = /var/log/mysql/mysql.log
general_log = 0
innodb_additional_mem_pool_size = 16M
innodb_log_buffer_size = 8M
innodb_log_file_size = 1G
innodb_log_files_in_group = 2
innodb_buffer_pool_size = 10G
innodb_flush_log_at_trx_commit = 2
innodb_thread_concurrency = 16
innodb_lock_wait_timeout = 600
innodb_flush_method = O_DSYNC
innodb_file_per_table
explicit_defaults_for_timestamp
__EOF__
# magento deps
aptitude install nginx-full php5-fpm php5-cli percona-server-server-5.6 php5-curl php5-gd php5-memcache php5-memcached php5-mysql mysqltuner percona-toolkit
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"
aptitude install redis-server php5-redis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment