Skip to content

Instantly share code, notes, and snippets.

@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: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:8144617
Created December 27, 2013 09:35
NodeJS behide Nginx
server {
listen 80;
server_name domain.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
@nghuuphuoc
nghuuphuoc / gist:8282411
Last active February 11, 2022 18:45
Install wkhtmltopdf on Centos 6 x64
$ wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
$ tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
$ mv wkhtmltopdf-amd64 /usr/bin/wkhtmltopdf
// In case you got the issue
// wkhtmltopdf: error while loading shared libraries:
// libfontconfig.so.1: cannot open shared object file: No such file or directory
//
// run the command below:
$ yum install urw-fonts libXext libXrender fontconfig libfontconfig.so.1
@nghuuphuoc
nghuuphuoc / gist:7398312
Last active March 17, 2021 02:58
Install npm, nodejs on Centos 6
# Enable Fedora Extra Packages for Enterprise Linux (EPEL) repos
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# Install npm from the epel repos
$ sudo yum install npm --enablerepo=epel
@nghuuphuoc
nghuuphuoc / Add swap
Last active December 7, 2020 10:55
Fix MySQL issue "Fatal error: cannot allocate memory for the buffer pool" on Digital Ocean server
// Check swap
$ sudo swapon -s
Filename Type Size Used Priority --> empty
// Create and enable swap file
$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
$ sudo mkswap /swapfile
Setting up swapspace version 1, size = 262140 KiB
no label, UUID=103c4545-5fc5-47f3-a8b3-dfbdb64fd7eb
2015-01-16 10:09:00.037 WindowLevels[72050:11476115] 0 (kCGBaseWindowLevelKey) : -2147483648
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 1 (kCGMinimumWindowLevelKey) : -2147483643
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 2 (kCGDesktopWindowLevelKey) : -2147483623
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 3 (kCGBackstopMenuLevelKey) : -20
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 4 (kCGNormalWindowLevelKey) : 0
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 5 (kCGFloatingWindowLevelKey) : 3
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 6 (kCGTornOffMenuWindowLevelKey) : 3
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 7 (kCGDockWindowLevelKey) : 20
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 8 (kCGMainMenuWindowLevelKey) : 24
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 9 (kCGStatusWindowLevelKey) : 25
@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) 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