Category Archives: Linux

Learn to rock Linux

You’ll have to take a look at the currently unmet business needs to help determine what will be the most benefit to the company.

Basic administration ideas

  • Monitoring: setup Nagios to monitor ping, disk space, cpu usage, on all network infrastructure
  • Monitoring: setup Cacti to monitor disk usage with historical graphs
  • Documentation: are all the server configurations and network information stored in an easily accessible, editable format (think wiki)? If not, roll a wiki instance on your server and document everything. Mediawiki is free, and okay. Atlassian Confluence is better, and not much more than free.

Monitoring and documentation are the two most critical administrative tools. These are the two pillars of an environment.

If you grew up as an IT guy on Windows, then you’ve been done a disservice. It’s okay, you can unlearn the evil. Here are some key differences that will help you become acclimated to Linux:

  • Troubleshooting: there’s always a log file, for every service and application in linux. Having a problem? Consult the log file. Can’t find the log file? Look in the startup script for the application.
  • Troubleshooting: learn strace. strace is the trace of system calls executed by a given program. You can see what files are opened, written to, etc, and this is a critically important tool for troubleshooting issues.
  • Troubleshooting: use “bash -x”. Running a bash script with the “-x” option shows you the execution line by line, and is very valuable for troubleshooting as well.
  • Troubleshooting (advanced): gdb (gnu debugger). You can run a binary program with gdb and inspect the call stack, see what’s stored in memory, and do other sweet shit.
  • Troubleshooting tools: netstat, ps, top, lsof, dig, nslookup, ping, tcpdump. Netstat is your eyes into what program is listening / bound to what port. ps and top let you know what programs are running and what their memory usage is. lsof lists open files, and tells you what programs are accessing them – very useful. dig, nslookup, ping, and tcpdump are all handy network troubleshooting tools.
  • Learning: man pages. Always read the man pages when you’re learning a new command, or try to. Sometimes they’re really very indiscernible, but often times they are not, and it’s faster than lazily googling for your quarry.
  • Learning: patience. Breathe. You can do it, but you’ll have to take it slow.
  • Learn what an inode is. That’s important.
  • Next level shit: learn Python. Another way to put this: learn linux, and Python, and get a few years (5-8+) under your belt – you’ll be earning 6 figures as a Unix engineer for some fancy fucking company.

Above all, remember: in Linux there’s almost always a semi-sane answer for what’s happening. You just have to know where to look. Log files, bash -x, strace, etc. The best way to learn is to setup some basic services and get your learn on. Try BIND, NFS, Samba CIFS, Nagios, Cacti, SSH via PKI, and then come back if you’ve done all that.

Oh, and turn off SELinux at first. That’s gonna be a real pain in the ass while you’re learning. Then turn it back on when you’re ready to do some security training.

Take some online (self-paced) redhat courses. These can be a little rote, but they’ve got value. Copy and paste the material into an electronic notebook for later use (http://evernote.com).

Hell if you can do all that, I’ve got a job for you.

Remote from Mac into Linux

You can use the X window system to ‘remote’ into another machine. In OS X it launches X11, as this is the X window client for Mac. What is actually happening is the remote system is sending system information to your local machine and allowing that to render the desktop and graphical views. This is opposed to the way VNC or Apple Remote Desktop works, by taking that already rendered image and compressing it down to sent it over the pipe. The ‘X -query’ tends to have better performance on remote systems because you aren’t sending full screen graphics, only remote system calls.
To do this, use the following command:

X -query I.P.Add.ress

(more…)