Add Swap Space on Ubuntu 16.04

Before begin, please check if the system already has swap space available. Even though it’s possible to have multiple swap files or swap partitions, one should be enough.

free -h

Output
total used free shared buff/cache available
Mem: 488M 36M 104M 652K 348M 426M
Swap: 0B 0B 0B

As we can see no swap is active on the system. We will create a 1 Gigabyte file in this guide. Adjust this to meet the needs of your own server:

fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

We can check the output of the “free” command again to verify the swap:

free -h

Output
total used free shared buff/cache available
Mem: 488M 37M 96M 652K 354M 425M
Swap: 1.0G 0B 1.0G

The swap space has been set up successfully and our operating system will begin to use it.

Now let’s make the swap space used permanently:

cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Done!

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”

Completely Disable IPv6

Kemarin saya udah buat tutorial dengan tujuan yang sama, untuk disable IPv6 di CentOS. Tapi kali ini saya akan kasih tau dengan cara yang lain, yaitu via GRUB2. Jadi seharusnya bisa untuk CentOS, Ubuntu, atau Debian.

Buka /etc/default/grub dengan editor, lalu tambahkan “ipv6.disable=1” pada direktif GRUB_CMDLINE_LINUX. Ini contoh di server Ubuntu 16.04 saya:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="ipv6.disable=1 elevator=noop"

Setelah itu jangan lupa untuk update GRUB, kalau Ubuntu/Debian;

update-grub

sedangkan CentOS;

grub2-mkconfig -o /boot/grub2/grub.cfg

atau

grubby --update-kernel=ALL --args=ipv6.disable=1

Enjoy!

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.