How to change your hostname in Mac OSX Lion
FInally migrated to Webfaction. Whoa, for a static HTML only blog, load times have finally decreased dramatically.
Check out the difference in load times, based on Google Analytics’ site speed. I migrated to Octopress on the 19th of December, shaving load times from a peak of 16 seconds!! to 2 seconds. Moving to Webfaction made it 0.9 seconds :)
Sometimes you may see the Virt Manager for Fedora 16 stuck at the state connecting.
Mirroring a directory over ftp.
Unfortunately rsync doesn’t support mirroring over ftp, but thats where lftp comes in handy.
I’m lucky in the sense I didn’t actively blog that much, (or a poor excuse for a blogger, depending on your POV) so I had like < 100 posts to migrate over. You could read more real life migration pains at Pixel-in-Gene.
For post conversion, I used Thomas Frössman’s exitwp plugin, which is written in Python. I then removed all the cruft personal posts that served no purpose, leaving only the technical bits in.
The none active comments are removed, but I’ll be adding a disqus section soon.
For now I’ll be working on optimizing my workflow for blog publishing, possibly through rsync, or maybe git.
If you use lftp alot, occasionally you will encounter sites that just use ssl to secure transmission, but don’t actually purchase a proper SSL cert for the domain.
You would get the following error message:
Fatal error: Certificate verification: Not trusted
If you are sure its really the intended site (No Man in the Middle Attacks!), you can temporaryly disable certificate verification by the following command at the lftp prompt:
lftp > set ssl:verify-certificate no
To permanently set this for lftp, you could add this to your
or in your home directory
Fedora 16 comes with OpenJDK by default. For certain application, you are required to use the SUN JDK. This post shows you how to download and install the latest Oracle Java Development Kit (JDK) and set Fedora to use it by default.
Download the latest Java JDK from here.
I used the tar.gz version. I choose to install it in
tar -zxf /path/to/your/jdk/download/jdk-7u2-linux-x64.tar.gz -C /opt
This extracts the Java JDK to
alternatives command to then set this as the default java.
# /usr/sbin/alternatives --install /usr/bin/java java /opt/jdk1.7.0_02/bin/java 200
- –install - Command to add an ‘alternative’
- /usr/bin/java - where the java program should be linked to
- java - The type of ‘alternative’ we are installing
- /opt/jdk1.7.0_02/bin/java - The full path to the java binary
- 200 - The priority of this version, the higher the number, the higher the chance of it being used first
Test this in the command line by typing
$ java -version java version "1.7.0_02" Java(TM) SE Runtime Environment (build 1.7.0_02-b13) Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
You will now see that it uses the Oracle Java.
Directory Listing is disabled in Lighttpd on Fedora 16 by default. Sometimes you want quick and dirty file sharing over http. Lighttpd is perfect for that.
First install lighttpd:
yum install lighttpd
Enable directory listing in
dir-listing.activate = "enable"
Opening a specific port in Linux / Fedora 16. This should work on all ditros that use use iptables.
For example. lets open the default DNS port to allow incoming queries for addresses.
- List your exising firewall rules
iptables -L --line-numbers -n
This will list the current rules you have in your firewall configuration Sample output:-
[root@i7 ~]# iptables -L --line-numbers -n Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 3 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination
- DNS Queries require a UDP packet to port 53 (by default). Since iptables rules are done on a first match basis, we’ll insert it to line 3 in the INPUT chain.
- The command to insert the rule:-
iptables -I INPUT 3 --proto udp --dport 53 -j ACCEPT
- -I INPUT 3: Insert rule into the INPUT chain at line number 3
- –proto udp: Incoming Packets that are of the UDP Protocol
- –dport 53: Packets destined for port 53
- -j ACCEPT: Jump to the ACCEPT chain (let the packet through)
- When you list the iptables rules again, It should show the new rule in line number 3 of the input chain.
[root@i7 ~]# iptables -L --line-numbers -n Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 3 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53 4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 6 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination
- Remember to then save your rules, else the next time the service is rebooted, your changes will be lost.
This post is just a reminder to myself. Due to the new Fedora Consistent Network Device Naming, a quick guide to how to ‘release’ it from the hassle of Network Manager.
- Determine the name of your device
[root@i7 ~]# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:424 errors:0 dropped:0 overruns:0 frame:0 TX packets:424 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:31696 (30.9 KiB) TX bytes:31696 (30.9 KiB) p34p1 Link encap:Ethernet HWaddr 20:CF:30:0F:37:4A inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::22cf:30ff:fe0f:374a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:297754 errors:0 dropped:0 overruns:0 frame:0 TX packets:190679 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:426415608 (406.6 MiB) TX bytes:15724959 (14.9 MiB) Interrupt:69 Base address:0x6000
In my case, the device is called p34p1.
- Create a file in
- Contents of file:
DEVICE=p34p1 IPADDR=192.168.0.10 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 HWADDR=20:CF:30:0F:37:4A DNS1=192.168.0.1 ONBOOT=yes NAME=Wired_Connection BOOTPROTO=none NM_CONTROLLED=no
- Important points to note:
- NM_CONTROLLED=no: Tell NetworkManager not to control this device
- DNS1=192.168.0.1: The DNS Server to use
- HWADDR: The MAC address of the NIC