Tag Archives: Linux

Setup 3proxy Anonymous Proxy on Ubuntu or Debian

The instruction suitable for all Unix distributions, because we are gonna compile it from source code. Compiling from source code is preferred, that way we will get the latest version. In this case I’m using Ubuntu/Debian.

To compile 3proxy from source code you need to install git, make, and gcc. Just type into your terminal:

apt-get install gcc make git -y

Next, browse to home directory

cd ~
git clone https://github.com/z3APA3A/3proxy.git

This will download latest version of 3proxy to your machine. Next step to compile and setup:

cd 3proxy
make -f Makefile.Linux

Now we put files into correct path and setup auto start of the service

mkdir -p /usr/local/etc/3proxy/bin
cp src/3proxy /usr/local/etc/3proxy/bin
cp ./scripts/rc.d/proxy.sh /etc/init.d/3proxy

Before we add 3proxy service to autostart, we need to do some adjustment to the default init script because it’s missing some LSB tags or else you’ll get some insserv warning.

vi /etc/init.d/3proxy

Change all the lines started with “#” with these lines:

#!/bin/sh
### BEGIN INIT INFO
# Provides: 3proxy
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Stop/start 3proxy
### END INIT INFO

Make the service auto start on boot

update-rc.d 3proxy defaults

Now let’s create the config file.

vi /usr/local/etc/3proxy/3proxy.cfg

You can RTFM for all the parameters or options, but to make it short, these are my config for anonymous proxy:
Continue reading Setup 3proxy Anonymous Proxy on Ubuntu or Debian

Disable IPv6 on CentOS 6

20120131ipv6logoI am a die hard fans of CentOS, and on every OS reinstall I always disable IPv6 first. Why do I do it? Simply because it doesn’t look nice with netstat -tulpen

So here is the quick and dirty way to disable IPv6 on CentOS:

echo install ipv6 /bin/true >> /etc/modprobe.d/modprobe.conf
vi /etc/sysconfig/network-scripts/ifcfg-eth0

add these two lines:

NETWORKING_IPV6=no
IPV6INIT=no

or.. you can add these lines too

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

simply reboot the system. That’s all.

CentOS Minimal Install

centoslogo_jvzxlk

Sebagai pengguna LowEnd VPS, saya selalu melakukan langkah-langkah ini setiap kali abis install ulang OS:

Membuang aplikasi yang ngga perlu.

yum grouplist

Fungsi command di atas untuk menampilkan aplikasi apa aja yang saat ini terinstall secara default. Contoh outputnya kayak gini (spot pada bagian “Installed Groups”):

Installed Groups:
CIFS file server
Console internet tools
Directory Client
Directory Server
E-mail server
Legacy UNIX compatibility
Network Infrastructure Server
Network file system client
Networking Tools
Perl Support
SNMP Support
Security Tools
System administration tools
Web Server

Nah selanjutnya kita tinggal buang seluruh group aplikasi tersebut (kecuali “Security Tools” karena di dalamnya ada “Yum” yang berfungsi untuk manajemen aplikasi):

yum groupremove "CIFS file server" "Console internet tools" "Directory Client" "Directory Server" "E-mail server" "Legacy UNIX compatibility" "Network Infrastructure Server" "Network file system client" "Networking Tools" "Perl Support" "SNMP Support" "System administration tools" "Web Server"

Menonaktifkan service yang ngga perlu

Karena CentOS server secara default running di run-level 3, jadi jalankan perintah ini untuk mengetahui service apa aja yang dijalankan ketika server startup:

chkconfig --list | grep 3:on
iptables 0:off 1:off 2:on 3:on
modules_dep 0:off 1:off 2:on 3:on
network 0:off 1:off 2:on 3:on
rsyslog 0:off 1:off 2:on 3:on
saslauthd 0:off 1:off 2:off 3:on
sshd 0:off 1:off 2:on 3:on

untuk server yang “fresh install”, service iptables aman untuk dinonaktifkan, jadi service yang aktif cuma tinggal modules_dep, network, rsyslog, saslauthd, dan sshd.

chkconfig iptables off

untuk mengaktifkan kembali service, ganti off pada perintah di atas jadi on.

Done. Hope this helps.

MySQL: "Access denied for user 'debian-sys-maint'@'localhost'"

Pengguna Ubuntu mungkin pernah sering ketemu error kayak gini:

[email protected]:~$ sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [fail]
* Starting MySQL database server mysqld [ OK ]
/usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

“debian-sys-maint” adalah MySQL user yang dibuat supaya Ubuntu bisa start / stop database dan melakukan operasi2 maintenance lain. Terus knapa ada error “access denied”?

Masalah ini terjadi biasanya karena ketika update MySQL, password user debian-sys-maint ngga ikut terupdate bersamaan dengan file konfigurasi yang baru. Tapi ternyata solusinya cukup simple:

Pertama, liat isi file /etc/mysql/debian.cnf

[email protected]:~$ sudo cat /etc/mysql/debian.cnf

Isinya kurang lebih akan seperti ini:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = n4aSHUP04s1J32X5
socket = /var/run/mysqld/mysqld.sock
 
[mysql_upgrade]
user = debian-sys-maint
password = n4aSHUP04s1J32X5
socket = /var/run/mysqld/mysqld.sock basedir = /usr

Perhatikan pada direktif password, itu adalah password user debian-sys-main yang kita cari. Selanjutnya, execute perintah MySQL untuk update password user debian-sys-maint sekaligus memberikan privilege yang diperlukan. Login kedalam MySQL server menggunakan root:

[email protected]:~$ mysql -uroot -p

Issue perintah GRANT untuk memberikan privilege:

mysql> GRANT ALL PRIVILEGES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'n4aSHUP04s1J32X5';

Selesai! Dan sekarang kalau kita restart MySQL, seharusnya ngga bakalan ada lagi error “access denied”.

[email protected]:~$ sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.

NGINX 301 Permanent Redirect

Nginx-logo_fhsccb

Redirect dari non-www ke www domain:

server {
servername example.org;
rewrite ^ http://www.example.org$requesturi? permanent; }

Redirect dari satu domain ke domain lainnya (external):

server {
servername old.com www.old.com; rewrite ^ http://www.new.net$requesturi? permanent; }

Perhatikan di situ ada $request_uri? – yang artinya bahwa user akan tetap mendapatkan struktur URL yang diminta pada domain baru. Misal user meminta old.com/haha/ maka secara otomatis NGINX akan me-redirect ke www.new.com/haha/. Hal ini akan sangat berguna apabila anda pindah alamat domain, namun masih ingin mempertahankan trafik / score SEO dari domain yang lama.