At work we have a lab setup, complete with serial console access to a variety of appliances. This console access was provided through an old console server, which was FULL of problems. The biggest thing was just a lack of connectivity. Since moving, we have replaced those old console servers and denied access to the lab to most peoiple, so this setup has been rendered unnecessary. But I have an old IP Appliance sitting at home, which I have been wanting to tinker with, and it has a serial console connector, and the computer I have set up does not. So now I am revisiting the RasPi Serial Client to get it going at home, and serve as a bit of a console server (even though there is only 1 serial connection). Read on to see how I went about accomplishing this.
Please note that this is my first larger-scale How-To. So you have any suggestions/improvements, feel free to use the comments section and I will take a look.
INITIAL SETUP
Install Raspbian to an SD Card. Adafruit has an awesome starter's guide here.
Once that has been completed, take a moment to edit the config.txt file. The key thing here is to set up the correct screen resolution so that we can finish setting everything up from a direct connection to the Pi. For full optionsfor the config file, elinux has a complete breakdown here. For my purposes, I am using an old (ancient really) monitor at 1024x768. Here's the entries I have for that:
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=16
Make sure youare directly connected to the Pi... Have a monitor plugged in and a keyboard and mouse, as well as your WiFi dongle. If you need to use a USB hub, plug the keyboard and mouse into the hub, leave the WiFi dongle directly connected to the Pi. For the monitor connection, I used an adapter like this from Adafruit. I also have a nice little wireless keyboard and trackpad combo for the keyboard/mouse connection. Turn on the Pi, and go through the little configuration wizard. It is very good. Make sure to expand the filesystem. Once that has been completed, reboot the Pi.
Once rebooted, get a terminal session, and run through the following commands:
First, let's update our repositories:
sudo apt-get update
Now, we install the additional softwares we'll be needing:sudo apt-get install tightvncserver minicom wicd-curses tcpdump iceweasel iceape bind9-host dnsutils inetutils-telnet ftp vsftpd hping3 scapy
While everything in Raspbian is free, there are a few packages I want to remove to free up space (and just to get rid of them, they are entirely useless for this application):sudo apt-get purge midori scratch dillo netsurf-common idle idle3 wolfram-engine
sudo apt-get --purge autoremove
Now that everything unwanted is removed, let's update EVERYTHING else:sudo apt-get upgrade
Now the Pi is completely updated! You will note that I only ran the upgrade AFTER removing the unwanted apps. The reason for this is simple: I did not want to upgrade something I was just going to get rid of.
Next, we configure SFTP and FTP access.
SFTP Access:sudo nano /etc/ssh/sshd_config
Change the default sftp server from:Subsystem sftp /usr/lib/openssh/sftp-server
toSubsystem sftp internal-sftp
SFTP Access is now granted to all users configured on the Pi. They will have access to the entire filesystem.
FTP Access: sudo nano /etc/vsftpd.conf
Change lines:
#local_enable=YES
change to local_enable=YES
#write_enable=YES
change to write_enable=YES
(Notice the lack of #, this means we are UNcommenting these lines, and making them active)
And if you want to disable anonymous access (which I strongly suggest):
anonymous_enable=YES
change to anonymous_enable=NO
Since the Pi will be directly connected to my IP Appliance, and the single ethernet connection will also be connected to the appliance, I need to set up my WiFi connection. Here's how we do it via command line:
sudo wicd-curses
Use the up and down arrows to select your wireless network, then the right arrow to configure it.
Now on to the good stuff...
SET UP THE SERIAL CONNECTOR
First, let us copy the files we will be editing, that way, if we mess up, it a very easy revert.
sudo cp /boot/cmdline.txt /boot/cmdline.bak
sudo cp /etc/inittab /etc/inittab.bak
Edit the file cmdline.txt:
sudo nano /boot/cmdline.txt
Remove the "console=ttyAMA0,115200
" and "kgdboc=ttyAMA0,115200
" configuration parameters. The file probably contains this default configuration line:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
After removing the two configuration parameters, it will look similar to this:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Save and close the file (Ctrl+X).
Next, edit the file inittab:
sudo nano /etc/inittab
Comment out the last line that contains "ttyAMA0
"
***SAMPLE CODE***
Save and close the file (Ctrl+X).
And this takes care of the configuration changes needed for this. Next, we get down and dirty with hardware.