Last active
July 9, 2018 15:26
-
-
Save maliMirkec/02c68bd94f1981d946200130ec935ef6 to your computer and use it in GitHub Desktop.
Step by step installation of VestaCP on Ubuntu 16.04 x64
This file contains hidden or 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
// Redis installation for Ubuntu 16.04 with PHP7 | |
// https://guides.wp-bullet.com/install-redis-object-cache-for-wordpress-php-7-on-ubuntu-16-04/ | |
// https://www.digitalocean.com/community/tutorials/how-to-configure-redis-caching-to-speed-up-wordpress-on-ubuntu-14-04 | |
apt-get update | |
apt install build-essential -y | |
cd /tmp | |
wget http://download.redis.io/redis-stable.tar.gz | |
tar xzf redis* | |
cd redis* | |
sudo make | |
sudo make install PREFIX=/usr | |
sudo mkdir /etc/redis | |
sudo cp redis.conf /etc/redis/ | |
cd .. | |
rm -R redis* | |
adduser --system --group --disabled-login redis --no-create-home --shell /bin/nologin --quiet | |
cat /etc/passwd | grep redis | |
usermod -g www-data redis | |
mcedit /etc/systemd/system/redis-server.service | |
// paste this code | |
------------------------------------------------------------------------------------------------------------------------ | |
[Unit] | |
Description=Redis Datastore Server | |
After=network.target | |
[Service] | |
Type=forking | |
Restart=always | |
User=redis | |
ExecStart=/sbin/start-stop-daemon --start --pidfile /var/run/redis/redis.pid --umask 007 --exec /usr/bin/redis-server -- /etc/redis/redis.conf | |
ExecReload=/bin/kill -USR2 $MAINPID | |
[Install] | |
WantedBy=multi-user.target | |
------------------------------------------------------------------------------------------------------------------------ | |
mcedit /etc/redis/redis.conf | |
// Set daemonize to yes for the systemd service. | |
// Change bind to only listen on localhost: 127.0.0.1 to prevent serious security issues | |
// Set maxmemory to 50M | |
// Change the maxmemory-policy to allkeys-lru | |
// Set stop-writes-on-bgsave-error to no | |
// Set rdbcompression to yes | |
systemctl enable redis-server | |
service redis-server start | |
// check if redis-server is running on port 6379 | |
netstat -lntp | |
------------------------------------------------------------------------------------------------------------------------ | |
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 11391/redis-server | |
------------------------------------------------------------------------------------------------------------------------ | |
ps aux | grep redis | |
------------------------------------------------------------------------------------------------------------------------ | |
redis 11391 0.0 0.4 38020 2160 pts/0 Tl 21:03 0:00 /usr/bin/redis-server 127.0.0.1:6379 | |
------------------------------------------------------------------------------------------------------------------------ | |
apt install php7.0-dev git -y | |
cd /tmp | |
git clone http://github.com/phpredis/phpredis php7 | |
cd phpredis | |
phpize | |
./configure | |
sudo make | |
make install | |
// turn on redis extension for nginx | |
mcedit /etc/php/7.0/mods-available/redis.ini | |
------------------------------------------------------------------------------------------------------------------------ | |
extension=redis.so | |
------------------------------------------------------------------------------------------------------------------------ | |
// symlink files | |
ln -s /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/fpm/conf.d/30-redis.ini | |
ln -s /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/cli/conf.d/30-redis.ini | |
service php7.0-fpm restart | |
// turn on redis extension for apache | |
mcedit /etc/apache2/mods-available/redis.ini | |
------------------------------------------------------------------------------------------------------------------------ | |
extension=redis.so | |
------------------------------------------------------------------------------------------------------------------------ | |
service apache2 reload | |
// download Redis object cache backend for WordPress and move it to wp-content | |
cd /home | |
wget https://assets.digitalocean.com/articles/wordpress_redis/object-cache.php | |
sudo mv object-cache.php /home/admin/web/xxx/public_html/wp-content/ | |
// enable caching | |
mcedit /home/admin/web/xxx/public_html/wp-config.php | |
------------------------------------------------------------------------------------------------------------------------ | |
define('NONCE_SALT', 'put your unique phrase here'); | |
define('WP_CACHE_KEY_SALT', 'example.com'); | |
define('WP_CACHE', true); | |
------------------------------------------------------------------------------------------------------------------------ | |
service redis-server restart | |
service php7.0-fpm restart | |
redis-cli monitor |
This file contains hidden or 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
# replace 22 with desired port number, save and exit | |
mcedit /etc/ssh/sshd_config | |
# restart ssh service | |
service ssh restart | |
# go to vestacp admin, firewall and edit ssh port |
This file contains hidden or 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
// https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04 | |
// Check the System for Swap Information | |
sudo swapon --show | |
free -h | |
// Check Available Space on the Hard Drive Partition | |
df -h | |
// Create a Swap File | |
fallocate -l 1G /swapfile | |
ls -lh /swapfile | |
// Enable the Swap File | |
chmod 600 /swapfile | |
ls -lh /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo swapon --show | |
// Make the Swap File Permanent | |
sudo cp /etc/fstab /etc/fstab.bak | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
// Tweak your Swap Settings | |
// Adjusting the Swappiness Property | |
cat /proc/sys/vm/swappiness | |
sudo sysctl vm.swappiness=10 | |
sudo mcedit /etc/sysctl.conf | |
//At the bottom, you can add: | |
------------------------------------------------------------------------------------ | |
vm.swappiness=10 | |
------------------------------------------------------------------------------------ | |
// Adjusting the Cache Pressure Setting | |
cat /proc/sys/vm/vfs_cache_pressure | |
sudo sysctl vm.vfs_cache_pressure=50 | |
sudo mcedit /etc/sysctl.conf | |
//At the bottom, you can add: | |
------------------------------------------------------------------------------------ | |
vm.vfs_cache_pressure=50 | |
------------------------------------------------------------------------------------ |
This file contains hidden or 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
// get vesta installation | |
curl -O http://vestacp.com/pub/vst-install.sh | |
// start vesta installation | |
// replace XXXXX, YYYYY, ZZZZZ with appropriate information | |
// go to https://vestacp.com/install/ and create install command | |
// if using nginx + php-fpm, add this under "location /" to every host | |
// try_files $uri $uri/ /index.php?$args; | |
// set limit to upload | |
// post_max_size = 20M | |
// upload_max_filesize = 20M | |
mcedit /etc/php/7.0/fpm/php.ini | |
// upgrade apt-get | |
apt-get update | |
apt-get upgrade | |
// install mc | |
apt-get install mc | |
// install git | |
apt-get install git | |
// enable apache mods by adding symlink to /etc/apache2/mods-available/ | |
mc /etc/apache2/mods-enabled/ | |
// fix mysql error | |
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-ubuntu.sh && chmod +x pma-ubuntu.sh && ./pma-ubuntu.sh | |
sudo dpkg-reconfigure phpmyadmin | |
// install nvm | |
apt-get update | |
apt-get install build-essential libssl-dev | |
mkdir nvm && cd nvm | |
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash | |
// load nvm | |
export NVM_DIR="/root/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
// install nodejs | |
nvm install latest | |
// install bower | |
npm install -g bower | |
// install gulp | |
npm install -g gulp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment