Setting Up DNSCrypt By OpenDNS On An Ubuntu 13.04 System

So I’ve just spent the time getting DNSCrypt working on my system. It was a bit of a pain but now that I got it done it shouldn’t be hard to recreate. I thought I’d write up a short guide explaining how to get it done.

Note that all double “-“s are turned into single ones. This is a WordPress issue. You’ll have to manually type them in, sorry.

Step 1: Setting Up A DNSCrypt User

sudo adduser --system --quiet --home /run/dnscrypt --shell /bin/false --group --disabled-password --disabled-login dnscrypt

That’s all one command. This is so that DNSCrypt can run as another user with no rights, and chroot itself into the directory.

Step 2: Install DNSCrypt

Find the right DNSCrypt version for you at this link:

http://download.dnscrypt.org/dnscrypt-proxy/

You’re going to have to unzip it and compile it. Traverse to the folder you’ve just unzippzed and run the following commands:

  • ./configure
  • make
  • make install

I personally have to run “make install” twice. No clue why.

Step 3: Configure DNS

Change your DNS settings to 127.0.0.1 in your network manager. Click the “wifi” area in the top right corner wifi and go to “edit connections”.  Select the network, and hit ‘Edit…’ then go to IPV4 Settings.

Make sure the Method is “Automatic (DHCP) Addresses Only” and set DNS Servers to 127.0.0.1

Step 4: Run DNSCrypt

Run the following command

dnscrypt-proxy --daemonize --user=dnscrypt

Step 5:

You can add the above command to /etc/rc.local so that it runs at bootup. You should also add the following command:

mkdir /run/dnscrypt

That way there’s a folder to move to.

That should be all it takes. Let me know how it works.

 

edit: You may need to install libsodium in newer versions, info here:

https://github.com/jedisct1/libsodium

Removing Zeitgeist Sped Up Unity

So I went through and started removing a ton of packages from my Ubuntu install. I use a SSD so I wanted to be sure I had as much space as possible.

I was shocked when I restarted and Unity was so much faster. Unity’s always pretty quick for me but when opening the Dashboard it was a bit choppy. I had attributed this to poor ATI drivers. Apparently I was wrong.

It was actually Zeitgeist. I removed it and now the panel opens up in a smooth and quick manner. It’s incredible that it had such a significant impact on performance without me realizing it. It was likely a bug, maybe even specific to my system, but removal meant opening the Dash with video in the background no longer slowed my system to a crawl.

So that’s goodbye to Zeigeist forever – never needed it anyways. If you’re looking to speed up Unity I suggest the same.

Performance in Ubuntu still isn’t perfect but ATI drivers have been improving.

For those looking to speed up Unity on ATI cards you may want to try

sudo apt-get install compizconfig-settings-manager

Then go to the CCSM and the OpenGL plugin and disable “Sync to Vblank”. Go back to CCSM and then the Composite plugin. This time disable the “Check refresh rate”. Apparently this is supposed to improve performance in Unity on ATI cards – I’ve yet to give it a try.

Understanding Swappiness

Swappiness is the term used to describe how often the system places information in the swap file/ partition. The system will do this when a program wants it to or when it’s running low on RAM. It’s a way to use HDD space to save on RAM, and it’s necessary for system stability in cases where the physical RAM is not enough for the system/ program to run with. But this guide isn’t going to tell you to turn swap off, just to turn it down a bit.

If you’ve got the RAM, follow this guide. If you don’t, leave the default as it is. I recommend having at least 2GB of RAM before you mess with swap, preferably 4GB. You’ll need to find the sweet spot for your setup.

Checking Current Swappiness

Swappiness can have a value of 0-100. I have 8GB of RAM and I run at ’10’ so if you’ve got 4GB I’d say consider ’20’ or ’30’ and 2GB you should consider ’40’ or ’50’ – there is no right answer, this all depends on usage habits.

In the terminal:

cat /proc/sys/bm/swappiness

You should see the output as something simple like ’60.’

The default for Ubuntu is ’60’ and it’s a safe number for performance but most modern machines can go lower.

How To Change Swappiness

Simply open up your favorite text editor (with sudo/ root rights) and open up /etc/sysctl.conf

Find the line:

vm.swappiness=X

and enter your desired value. 

Save and reboot and you’re good to go.

It’s just a small but easy way to tweak your Ubuntu and speed up Ubuntu or other Linux system in order to get the most out of it. In the spirit of my last post about defragging I think it’s appropriate.