Skip to content

Instantly share code, notes, and snippets.

@nghuuphuoc
nghuuphuoc / 1) Add repos
Last active July 30, 2018 22:22
Install PHP 5 on Centos 6
// Install remi repos
$ 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
@nghuuphuoc
nghuuphuoc / gist:7781168
Last active December 30, 2015 05:09
Install MongoDb on Centos 6
// Add mongo repos
$ nano /etc/yum.repos.d/10gen.repo
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1
// Install Mongo
$ yum install mongo-10gen mongo-10gen-server
@nghuuphuoc
nghuuphuoc / gist:7800147
Last active December 30, 2015 08:08
Backup and restore Mongo database
// http://docs.mongodb.org/manual/tutorial/back-up-and-restore-with-mongodb-tools/
// Backup
$ mongodump -u {username} -p {password} --db {db} --out {output}
// Restore
$ env LC_ALL=en_US.UTF-8 mongorestore --port {port number} --dbpath {db path} {path to the backup}
@nghuuphuoc
nghuuphuoc / 1) Install
Last active September 4, 2023 09:29
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ 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
@nghuuphuoc
nghuuphuoc / gist:7801133
Last active January 14, 2019 17:18
Install ImageMagick on Centos 6
// Install ImageMagick
$ yum install ImageMagick ImageMagick-devel
// Install php imagick extension
$ yum --enablerepo=remi,remi-test install php-pecl-imagick
@nghuuphuoc
nghuuphuoc / 1) Install
Last active December 26, 2017 19:59
Install Vanish on Centos 6
// Add repos
$ rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm
$ yum install varnish
$ chkconfig --level 345 varnish on
// Start Vanish
$ /etc/init.d/varnish start
@nghuuphuoc
nghuuphuoc / gist:7867103
Created December 9, 2013 03:42
Zip directory on Linux
zip -r file.zip /path/to/src/dir
@nghuuphuoc
nghuuphuoc / gist:7874407
Created December 9, 2013 15:55
Backup and restore MySQL database
// Backup
$ mysqldump -u [username] -p [databasename] > [filename.sql]
Enter password:
// Restore
$ mysql -u [username] -p [databasename] < [filename.sql]
Enter password:
@nghuuphuoc
nghuuphuoc / gist:7876037
Last active December 30, 2015 19:39
Install Memcached on Centos 6
$ yum install memcached
// Configure Memcached
$ nano -w /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="512"
OPTIONS=""
@nghuuphuoc
nghuuphuoc / gist:7884874
Last active March 2, 2017 08:11
Some of useful Nginx rewrite rules
// Nginx redirect non-www to www
server {
listen 80;
server_name domain.com;
rewrite ^/(.*)$ http://www.domain.com/$1 permanent;
}
server {
listen 80;
server_name www.domain.com;