Tag Archives: linux

Internet Connection Sharing Via Wi-Fi On Fedora Linux

I was very tired yesterday evening, so I thought about tweeting through my iPhone while lying in bed. EDGE is pretty slow and expensive, and 3G hasn’t yet arrived in Moscow (military issues) so I decided to go with Wi-Fi. Good idea, huh? And it took me just a couple of hours to set the whole thing up. I’m running Fedora Linux 10 but you should’t have much trouble on other distros.

Setting up a Wi-Fi hot spot at home using a simple Wi-Fi router is the easiest way to go around, but that costs like a hundred bucks – not worthed. I’ve managed to setup an Ad-hoc (computer to computer) connection using my built-in 10m Wi-Fi module on my laptop PC. If you ever ran a Windows OS (duh!) you might know that sharing an Internet connection on your LAN is quite simple. My situation’s slightly different. A Vista running box is already sharing a PPPOE connection through LAN to two other laptop PCs, one of which is my favourite Fedora 10 box.

Anyways, the wired network on Fedora is set up and works fine (eth0 interface). Hadn’t had to iptables anything, nor should you ;) Now, setup a wireless network. Make sure you choose Ad-hoc (computer to computer) connection, input a passkey and setup your IP settings: 192.168.1.1, 255.255.255.0 and use 192.168.1.1 as your Route in case Fedora says it’s required (mine did). You might also need to input your DNS information (you can obtain your DNS information by running cat /etc/resolv.conf). This is all setup in the Networking manager (a Gnome utility AFAIK). Activate the connection and run ifconfig to make sure you’ve got a wirelass connection available (you should see a wlan0 section).

At this point you might want to test your connection. Get some device to ping your computer and try to ping back. Remember that you’ll have to setup IP information on your device manually (unless you’ve got a DHCP server running on the wlan0 interface). Pings fine? Okay, good. Now, all you’ve left to do is run a simple iptables script. Go ahead and generated one: Easy Firewall Generator for iptables. Don’t forget to pick the Gateway/Firewall option. Mine settings were like this:

  • Internet interface: eth0 (this is my wired LAN)
  • Static Internet IP Address (my wired LAN address)
  • Internal Network Interface: wlan0 (the wireless network)
  • Internal Network IP Address: 192.168.1.1
  • Internal Network: 192.168.1.0/24
  • Internal Broadcast: 192.168.1.255

The Generator will give out a shell script. Copy the contents and paste into a file (/home/kovshenin/wifitables.sh). Then:

$ cd /home/kovshenin
$ chmod a+x wifitables.sh
$ ./wifitables.sh

All done! I can now tweet free from the kitchen, balcony, bathroom and even from my toilet! :) Now I’m thinking about setting up a VNC server, so I’d never have to go back to my laptop PC again. Oh and by the way, if you DO have a feeling that you’ve messed up iptables, just run the iptables-restore command and start over. If you’re sure you got everything correct, use the iptables-save command, so that you wouldn’t need to run the script everytime you boot your system. Good luck everyone, and happy tweeting!

P.S. I’m glad to have some more connections on Google FriendConnect. Welcome newcomers! Hope you enjoy your stay!



Gone Mobile: SSH Terminal on Your iPhone

I was in a bus today in the morning standing in a traffic jam, when I suddenly got a call from my colleague Alex. He said that he messed up something in our database on my virual private server and didn’t know what to do because everything stopped working. Alex doesn’t know what SSH is and how to work with Putty so I had to figure this out all by myself and fast. Luckily I found TouchTerm – it’s a free SSH client for your iPhone. Download available in the App store.

It took me around thirty seconds to connect to my server, restore the database and make a couple of backups ;) screenshots:



Benchmarking: Your Web Hosting is Not That Perfect

Today I realized that the VPS I’m renting for $20/mo is not as good as it seemed at first. Ever thought about high loads? Okay, this may sound like some DDoS hacking tools, but no! 100 requests with 10 simultaneous made my virtual private server think for ~ 1,5 minutes. Jeez!

It took me quite some time to find good software for running some load tests on my webserver, linux has some good utilities (linux.com/feature/143896), but I suggest you start from ApacheBench which is a command line utility bundled with the Apache distribution. It’s cross-platform, therefore you can use it on Windows (I did). Anyways, here’s how you launch a test:

ab -n 100 -c 10 http://www.microsoft.com/

Why did I pick Microsoft? Well, if I get like 10,000 views tomorrow and everybody tries that command, that’d be a DDoS attack on Microsoft servers and I think they’re good enough to handle it. My server would just explode :)

Anyways, take a look at what the results may be like:

Benchmarking www.kovshenin.com (be patient).....done

Server Software:        Apache/2.2.8
Server Hostname:        www.kovshenin.com
Server Port:            80

Document Path:          /
Document Length:        84 bytes

Concurrency Level:      10
Time taken for tests:   90.984 seconds
Complete requests:      100
Failed requests:        1
   (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Write errors:           0
Non-2xx responses:      100
Total transferred:      36564 bytes
HTML transferred:       8674 bytes
Requests per second:    1.10 [#/sec] (mean)
Time per request:       9098.438 [ms] (mean)
Time per request:       909.844 [ms] (mean, across all concurrent requests)
Transfer rate:          0.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   15   3.4     16      16
Processing:  2203 8866 8879.2   6188   48797
Waiting:     1969 8532 8664.9   5891   48750
Total:       2219 8880 8879.6   6203   48813

Percentage of the requests served within a certain time (ms)
  50%   6203
  66%   7281
  75%   8141
  80%   8313
  90%  17078
  95%  32266
  98%  43813
  99%  48813
 100%  48813 (longest request)

Ah.. And a failed request there, how sad… You might also want to check out your load on the server while benchmarking. Use the ‘top’ command, it should produce similar output:

Yup, although the super cache plugin is working, wordpress consumes a lot of memory… I also ran this with a 500/100 requests, that made my server go down for like 6 minutes, I had over 200 failed requests and my blog kept saying database connection error until the test had finished. Free memory dropped down to 0! Scary? For more information about how ab works, read Apache HTTP server benchmarking tool documentation at apache.org.



Three Linux Commands You Can't Live Without

Okay, we’re not going to talk about the shutdown, yum, etc. commands, though THEY are probably the ones that nobody can live without. I’m talking about the web here, remember? And we all know that not everybody owns a VPS, a VDS or a dedicated server. Virtual hosting plans are quite cheap today, and most of them are tuned to provide you with SSH access and basic privileges (although I DO highly recommend you get yourself a VPS, it’s not much more expensive than virtual hosting and I’m sure it’s worthed). These linux commands are extremely helpful when doing backup or moving from one server to another.

1. Create a compressed archive of the current directory:

tar -cvzf backup.tar.gz ./*

2. Create a compressed archive of a MySQL database dump:

mysqldump -u username -p password -h host -P port databasename | gzip -c > mysql.sql.gz

3. Get directory contents from a remote FTP server:

wget -r ftp://username:password@domain.com/directory/*

Hope that helped ;)



TweetDeck & Seesmic Desktop on Fedora 10

Hey just got TweetDeck running on my Fedora 10 Laptop. It took me about 20 minutes to figure this out, I just had some permission issues (error 5100). Go get the latest Adobe Air from the official Adobe Air website and save it somewhere. Then you’ll have to chmod +x the .bin file to be able to execute it. Run it using your root account – that should install Adobe Air and some utilities for Air application management, just like Windows would (I guess).

Then, download the latest TweetDeck Air application for Linux. Now here’s where I got the permissions issues. You have to run the TweetDeck installation as root, otherwise you will not be able to write to the /opt directory – that’s standard for Air applications, though I wasn’t able to write to /home/myuser either, although I had full rights to access that, so I guess the right place is actually /opt. Open your terminal, logon to root and try the following:

/usr/bin/Adobe AIR Application Installer

That should launch the Adobe AIR app installer. Pick the TweetDeck .air file and attempt to install it. Worked for me. You can create the shortcut icons, but you shouldn’t launch TweetDeck after installation, cause you wouldn’t wanna run it as root, right? After the setup’s finished check out your Applications – Accessories menu, you should see TweetDeck.

Hope that helped. Used to TwitterFox but I guess TwitterDeck will do just great. Don’t forget to choose the right tweets update configuration (I got it working at about 80%). Don’t overload the API and don’t forget to switch off any other Twitter clients you use before launching TwitterDeck.

Updating TweetDeck or Seesmic Desktop on Fedora

I’ve stopped using TweetDeck for a while due to a couple of reasons. I got my Twitter developer account which gives me 20,000 API calls per hour (unlike the ordinary accounts with 100), and the new TweetDeck doesn’t work with that amount (I’ve no idea why), so I had to switch to Seesmic Desktop which is also based on Adobe AIR, thus cross-platform and I managed to install it on my Fedora 10 machine using the above method.

Updating TweetDeck and Seesmic Desktop (and all other Adobe AIR applications) is quite straightforward in Windows and Mac, but I came up with the same permissions issues in Linux. It seems that we’re not allowed to use the auto-update feature (the popup-box that shows up when you run TweetDeck and asks you to automatically update the software). So we’ll probably have to go the other way round. Go to TweetDeck or Seesmic Desktop official website and download the latest .AIR distro, save it somewhere, and as root run the AIR Application Installer program:

/usr/bin/Adobe AIR Application Installer

Select your .AIR file and update. After the update it automatically runs the new version of TweetDeck (or Seesmic Desktop). Close that. It’s being run under root, while your profile is on your regular user. Just start as a regular user and everything should be fine. Worked for me ;)

Good luck!

Updated June 20th 2009



Gnome Keyboard Shortcuts

… and the Super key. I don’t know if everybody knew about this trick already, but it seems that Gnome has got this bug, that doesn’t let you bind keyboard shortcuts with the Super (windows key) combination, except the Super key itself (alone). Anyways, the work-around is using the Gnome Configuration Editor and just type in the combination in text. Browse to /apps/metacity/ (there are 4-5 sections).

If you don’t have the gconf-editor just yum install it (in Fedora):

yum install gconf-editor


Twitter on Fedora Linux

I got tired of using my web browser for twittering, so I looked for some twitter applications for linux. A list of the best ones can be found in the Twitter Fan Wiki. I’ve tried a couple, but Twitux suited me best. It looks pretty good, runs under Gnome and supports gui-notifications.

To install Twitux on a Fedora machine change to root and yum install it:

su -
yum install twitux

That will get you the latest Twitux installed and listed in your Applications – Internet menu. One thing that I didn’t like about Twitux is that ugly dinosaur icon that it came with, so I started searching the net for how to change it. Here are the locations of twitux icons which can be swapped:

/usr/share/icons/hicolor/scalable/apps/twitux.svg
/usr/share/icons/hicolor/48x48/apps/twitux.png

You have to be root to access those locations for writing. You can download a 48×48 Twitter PNG from iconarchive.com in the Web 2.0 Icons post. And thanks to lopagof you can get an SVG from deviantart.com. Don’t forget to logout and back in for your new icons to take effect.

I’m not sure about the task bar icon, cause I was able to change it just by right-clicking it in my Avant Window Navigator. GUI notifications still run that dinosaur icon though, so I turned it off :)

P.S. Follow me: twitter.com/kovshenin



Fedora Linux 10 Partitioning

Okay, so I had my Fedora 10 system running out of disk space a few days ago, so I started looking for solutions to re-partition my hard drive. Yeah, GParted seemed like a good one, but it hasn’t got the power to resize currently mounted partitions, nor to run batch-scripts like Symantec Partition Magic (windows) does. The structure of my hard-drive looked something like this in the exact same order physically:

  • Primary NTFS (C:)
  • Primary extended:
    • Linux /boot
    • Linux /
  • Primary Linux swap
  • Primary HP Recovery NTFS (D:)

The HP Recovery partition is the one used to recover my Windows Vista on C:. Anyways, I managed to resize the first primary NTFS with GParted, booted up my Windows Vista. Through Paragon Partition Manager I managed to move and resize the extended primary partition closer to the first primary C:, moving /boot and expanding /. And that was probably where I messed up.

I restarted my computer and GRUB refused to boot my Fedora Linux, stating that /sbin/init is not found. Alright, I booted back to Vista, opened Paragon Partition Manager and accidentally clicked on some button called "Boot Wizard" which popped out a dialog box saying "Complete!". And this is where the fun stuff began…

After another reboot, I realized that grub is dead, and instead I see a Paragon Boot Wizard asking me to pick either “Boot from C:” or “Boot from HP Recovery”. The first option didn’t work, so I booted HP Recovery. The Recovery program analyzed my system and recovered the Vista partition, together with the MBR. Okay, so now I can boot my brand new Vista :)) At this moment I quickly burned a Fedora 10 Live CD and restarted again.

I managed to recover my previous GRUB boot loader from the Live CD and noticed that my old linux filesystem was mounted in /media/- (tutorials stated that it should be mounted to /mnt/sysimage). Anyways, I tried to chroot /media/- which said that I’m missing /bin/bash, and an ls -a /media/-/bin got me shocked! It was almost empty. Jesus christ! Although the /home /usr /sbin and other directories were okay. So I backed up my home directory and reinstalled Fedora 10 in about 20 minutes (plus software installation for about an hour). Now I’m back online and happy (I still do experience some PulseAudio problems in Skype though).

Well, the bottom line is don’t use any windows partition editors, nor laptop recovery systems together with linux filesystems. I bet that the GParted Live CD would have done the job for me in minutes.