Search This Blog

Showing posts with label CrunchBang Linux. Show all posts
Showing posts with label CrunchBang Linux. Show all posts

20150214

Improving My Web Browsing (Linux)

DISCLAIMER: This project is posted for information only and should take no more than 2 hours to complete. Only an experienced Linux user should attempt this task due to the work involved. It requires being comfortable at the command line and downloading packages from the Internet.

Overall, I rate this project as "advanced" since an experienced Linux user will be able to understand what I planned to do and implement it. YMMV

In this project, I worked at getting polipo to work with pdnsd. My intention was to speed up polipo, the caching web proxy server. Information on polipo is found by entering apt-cache to show its description:

$ apt-cache show polipo

Originally I started with polipo, and noticed that Iceweasel was lofting and wait times while loading web pages was over 15 seconds. After searching on the Internet for "speed up polipo" I happened on a post on the crunchbang.org forum by "hardran3" entitled '"Faster" browsing with polipo & pdnsd.'

Polipo is configured to show:
  • its menu at http://127.0.0.1:8123/polipo/
  • its status at http://127.0.0.1:8123/polipo/status?
  • its current configuration at http://127.0.0.1:8123/polipo/config?
  • its known servers at http://127.0.0.1:8123/polipo/servers? and
  • and its disk cache index at http://127.0.0.1:8123/polipo/index?
As instructed on the tips page, I installed pdnsd using aptitude: $ sudo aptitude install pdnsd

Pdnsd is the proxy DNS server with permanent caching. More information on it is found by entering apt-cache to show its description: $ apt-cache show pdnsd

After installing polipo, I edited /etc/polipo/config without ad-blocking and allowed the amount of information leaked by commenting the lines for censoredHeaders and censorReferer.

In this way it was adapted for Crunchbang Linux on my desktop PC which is directly connected to the Internet via aDSL modem / router.

Next, /etc/pdnsd.conf was edited using the configuration shown. However, the original text for pdnds.conf was missing a "}", so the last six lines of the code given should be:

48:source {
49: ttl=86400;
50: owner="localhost.";
51: serve_aliases=on;
52: file="/etc/hosts";
53: }


I also opted to keep the following from /etc/pdnsd.conf:

55:rr {
56: name=localhost;
57: reverse=on;
58: a=127.0.0.1;
59: owner=localhost;
60: soa=localhost,root.localhost,42,86400,900,86400,86400;
61:}


However, the above 7 lines are optional. Finally I edited the /etc/dhcp/dhclient.conf file as directed.

In order to get pdnsd to run, the file /etc/default/pdnsd also needs to be edited as follows:

01: # do we start pdnsd ?
02: START_DAEMON=yes


* Note that I prefaced lines in the respective configuration files with line numbers. This is for information purposes and should be left out in each file.

To get dhclient to restart, unplug the network cable and plug it back in. If it still isn't reset, do not worry. Just start up polipo with: $ sudo /etc/init.d/polipo restart

The system will respond with: Restarting polipo: polipo. ...and start up pdnsd with:
$ sudo /etc/init.d/pdnsd restart

To which the system will respond with: [ ok ] Restarting pdnsd (via systemctl): pdnsd.service.

To check the status of and ensure pdnsd is running: $ sudo /etc/init.d/pdnsd status
The system will respond with:  

● pdnsd.service - LSB: Start pdnsd
   Loaded: loaded (/etc/init.d/pdnsd)
  Drop-In: /run/systemd/generator/pdnsd.service.d
           └─50-pdnsd-$named.conf
   Active: active (running) since Sat 2015-02-14 01:17:28 PST; 2h 42min ago
  Process: 24149 ExecStop=/etc/init.d/pdnsd stop (code=exited, status=0/SUCCESS)
  Process: 24156 ExecStart=/etc/init.d/pdnsd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/pdnsd.service
           └─24161 /usr/sbin/pdnsd --daemon -p /var/run/pdnsd.pid


Once pdnsd is running, polipo is using 127.0.0.1 as the address for the internal DNS server. Overall, the time spent debugging was due to pdnsd not starting up.

Once it started running, I got the following response using netstat: $ sudo netstat -atunp | grep "127.0.0.1:53"




Results:

Internet response times are improved. Most of the webpages are cached permanently in /var/cache/polipo and the DNS information in /var/cache/pdnsd - this allows for faster access to webpages because they are permanently stored in cache.

Update; 20150411

I have also added the polipo and pdnsd packages to my netbook which runs Mint 17.1.


Sometimes I get one webpage that never resolves on my netbook. After careful research of the issue (504 Gateway error) led me to reinstall resolvconf. Then I added GoogleDNS to server section in /etc/pdsnd.conf to improve lag time:

server {
label = "GoogleDNS";
ip=8.8.8.8;
proxy_only=on;
timeout=10;
}

After forcing a reload of pdnsd, I could access the webpage.


Kudos: Thanks to Hardran3 for the tips on getting polipo to work with pdnsd, and especially to Jiri H for developing Crunchbang Linux.

While development of Crunchbang Linux is finished, I will still use it because it still works.

Reference:

Caching Web Proxy and DNS Server pictures:

Crunchbang:
Index
» Tips, Tricks & Scripts
» "Faster" browsing with polipo & pdnsd

http://crunchbang.org/forums/viewtopic.php?id=11881

Mint Linux is derived from Ubuntu, and the following link helped with resolve the 504 Gateway error:

http://www.n00bsonubuntu.net/content/speed-up-your-web-browsing-by-caching-dns-to-your-hard-drive-in-ubuntu/

20140223

Getting Doc-Central To Display Compressed Documentation as Text

This article has to do with Apache web server and the Doc-Central and Dwww documentation utilities for Linux. It is intended for experienced Linux users who are familiar with Apache, Doc-Central and Dwww.

Crunchbang Linux 11 comes with Apache2.

Today I installed dwww and Doc-Central so I can use Chrome to read documentation.

Dwww can read both plaintext README files and related files and the compressed changelog.gz, changelog.Debian.gz, NEWS.gz, and README.gz files. However, Doc-Central can only read plaintext files.

So the challenge was to get Doc-Central to display the GZipped documentation as plaintext on a web browser.

So I spent an hour researching the problem and came up with the following solution:

To set up Apache serve so that Doc-Central display so that changelog.gz, changelog.Debian.gz, NEWS.gz, and README.gz are displayed as text, change the mime.conf by uncommenting all the lines containing AddType.

Then change the alias.conf by adding the following text after the comments:

Alias /doc/ "/usr/share/doc/"

<directory "/usr/share/doc">
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all

AddEncoding gzip gz
<filesmatch "\.gz$">
ForceType text/plain
Header set Content-Encoding: gzip
</FilesMatch>
</Directory>

Finally, restart Apache using apache2ctl:
$ apache2ctl restart

It will take a few minutes for Apache to update Doc-Central.

When I checked Doc-Central again, the compressed text displayed as plaintext.

20130228

Good Morning Internets

Today I'd just turned on my computer, and booted up CrunchBang Linux, when I noticed it was slow.

Webpages that used to display within seconds, appeared to crawl.

Rather than Google it, I realized that Firefox was loafting. Perhaps the culprit is Java.

Guh, this is like having sex with your partner for a half hour, and nobody is coming...
home!

All you get out of it is being sore, but the soreness I'm getting is impatience.

Anyway, my rant is over. I gotta check all the windows in Firefox, in case I can see through the panes to the Internet.

Good morning, I'm back!

20130221

No write access to USB drive - Crunchbang Linux

Warning: this Linux problem is written for intermediate and advanced Linux users.

Note to intermediate users: please RTFM before attempting to use any app as described in this problem.

Disclaimer: This blog article is for information only. I take no responsibility for its misuse by any Linux user who chooses to act based on the information presented.


Identifying the Problem


Recently I solved a problem involving my USB flash drive.

While working on Linux, I learned a lot about the apps used in solving the write access problem associated with it. This solution consisted of creating an entry in the file system table for the flash drive.

While it may be mounted using the file manager, this fix prevents unmounting of the flash drive.

The file manager accesses the flash drive preventing its unmounting, which is fixed by exiting the file manager.

After exiting, the flash drive may be safely unmounted before removing the flash drive.

Device and Media Descriptions


Device and media names:
  • /dev/sdc1 : device label for USB flash drive
  • /media/usb2 : media name for mounted flash drive
Apps used:
  • man: used to read thoroughly descriptions of the following apps and files
  • pmount, pumount : to mount and unmount the drive safely; use only as user
  • mount: to check the list of mounted media; DO NOT USE TO DISMOUNT media.
  • blkid: to list the mounted media's UUIDs.
  • chown: use to assign owner rights to user.
  • chgrp: use to assign group rights to user.
  • lsof: use on device name for USB flash drive.
  • gksu: command run to temporarily assign root access to user; used with gedit to edit fstab.
File changed:
  • fstab: file system table used to mount devices such as hard disk drives and removable media.
Note: I recommend that the manual for fstab be read carefully. Graphic apps
  • gedit: used to edit fstab
  • thunar: file manager

Problem

Usbmount mounts my USB flash drive as root. As a result of this, I have no write access to it using thunar. Remounting the flash drive allows me to mount and unmount it but still no write access. Description of problem Yesterday I reformatted my USB flash drive as a Linux partition on my PC running Crunchbang . After formatting, it was disconnected and then connected to the PC. Once I checked the flash drive, the following issue arose: I had no write access to it. As well, I couldn't unmount the drive. During the debugging process, I noted that when the flash drive is first connected to the PC, usbmount mounts it as root. When I remounted the flash drive using both pumount and pmount, I could mount and unmount it but still had no write access. According to what mount tells me, the flash drive is assigned as a device named "sdc1" — /dev/sdc1 — and is mounted as a media device named "usb2" — /media/usb2.

Solution

Using gedit, I edited fstab by adding a line containing the UUID of the flash drive. Disconnected and connected the flash drive. Also gave owner and group rights to user for /media/usb2. Linux now allows write access to /media/usb2. To unmount drive, exit from thunar and unmount using pumount. Description of solution With chown and chgrp, assigned owner and group right to user for /media/usb2. To solve the usbmount issue on my PC, I edited /etc/fstab using blkid to find the UUID for /media/usb2. To ensure that Linux mounts only the flash drive, its UUID is used to identify it rather than /dev/sdc1 or /media/usb2. Use of lsof on flash drive determined that thunar has access to it. After exiting from thunar, pumount is used to unmount flash drive. Once the flash drive is unmounted, it can be removed from the PC.

20130212

Crunch Bang Linux Tips: Pulling App Window Into Toolbar and Moving Conky Display

Recently I wanted to do two things on my PC running CrunchBang Linux: pull an app window into its topbar and move my conky display from top right to bottom right.

Here are my two tips on how I accomplished both tasks.

1) How to pull an app window into its topbar

Left-click with the mouse on the up-arrow in the window manipulation area in the top right corner of an app window pulled the app's window into its topbar

The reason why I wanted to pull the app window into its topbar was to move it to the top of the screen.

With both topbars for Terminal and Iceweasel are at the top of the screen, put of the conky display is obscured.

This brings us to my next tip...


2) How to move conky display from top-right to bottom-right

The reason for this change was when Iceweasel and Terminal had their respective window pulled into their respective topbar, it would hide the top of conky's display.

To make conky display at bottom-right, I replaced the alignment item in .conkyrc from "top-right" to "bottom-right."

To do this I used the following command to open up .conkyrc in my home directory using gedit:

$ sudo gksu gedit .conkyrc

The line to change is:
alignment top_right

Just change "top" to "bottom".

Then save .conkyrc and close gedit.