Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Dec 19, 2016

How to install Composer, PHPUnit in Ubuntu

Composer and PHPUnit packed with phar, so we need only append these lines into ~/.bashrc:

# change location to your phpunit.phar
alias composer=~/bin/composer/composer.phar
alias phpunit=~/bin/phpunit/phpunit.phar
We also install composer this way:

sudo curl -sS http://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Check them installed or not?
phpunit --version
composer --version

Oct 22, 2016

Speed up Ubuntu by configuring swappiness

I forget to config swappiness when my Ubuntu 16.04 installed. So I note it today.
Wiki defines:
Swappiness is a Linux kernel parameter that controls the relative weight given to swapping out runtime memory, as opposed to dropping pages from the system page cache. Swappiness can be set to values between 0 and 100 inclusive.
#Use terminal to see system stats
htop

Swap memory is low because it is hard disk treated as memory. It is second "RAM memory". Ubuntu system comes with a default of 60, meaning that the swap file will be used fairly often if the memory usage is around half of my RAM. You can check your own system's swappiness value by running:

cat /proc/sys/vm/swappiness
10

I wanna the swap file only be used when my RAM usage is around 80 or 90 percent. To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:
vm.swappiness = 10
Alternative ways:
# Set the swappiness value as root
echo 10 > /proc/sys/vm/swappiness
# Alternatively, run this 
sysctl -w vm.swappiness=10