Linux Administration for Developers

589 views

Published on

Linux administration background needed for Open Source developers. specifically those using RubyOnRails

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
589
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
19
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Linux Administration for Developers

  1. 1. Linux Administration for Developers by Mahmoud Said
  2. 2. Outline● Why● Linux Basics● Servers● WTF● More monitoring tools 2
  3. 3. Why● Free● Hosting Open Source web apps● Developing Open Source apps● Robustness● Development by Community 3
  4. 4. WhyAdmin Common Knowledge Developer 4
  5. 5. Linux Basics 5
  6. 6. Filesystem“Everything is a file” ● Regular files ● Directories ● Symbolic links ● Hard links ● Devices ● Sockets 6
  7. 7. Filesystem - Filenames● Case sensitive● Can contain any character except “/”● Extensions are only used for user convenience● Examples: README .bashrc index.html My World conf.old database.yml.bak 7
  8. 8. Filesystem – File pathes● Sequence with nested directories ending with or without a file● Relative: config/database.yml● Absolute: /etc/nginx/nginx.conf● Special pathes: ~/ #home of current user / # root .. # parent directory 8
  9. 9. Shells● Interface to execute user commands● Hide the details of the OS● Text based Commands● Can be scripted 9
  10. 10. Famous Shells● sh The Bourne shell (obsolete) Traditional, basic shell found on Unix systems, by Steve Bourne.● csh The C shell (obsolete) Once popular shell with a C-like syntax● bash The Bourne Again shell (most popular) An improved implementation of sh with lots of added features. 10
  11. 11. Scripting● Commands to the shell can be scripted● The script can be passed to the interpreter, or it can be executed by specifying the interpreter at the beginningbash init.sh.old #!/bin/bash./init.sh.old echo “bash script...”ruby setup.rb #!/usr/bin/ruby./setup.rb puts “ruby script...” 11
  12. 12. Common bash commandspwd cat findls less sortcp more wccd vim aliasman nano echomkdir tail lnmv head chmodrm grep chownrmdir crontab 12
  13. 13. Bash Keyboard commands● TAB # auto completion● CTRL+R # search commands history● CTRL+D # exit the current shell● CTRL+P # previous command (also “up”)● CTRL+N # next command (also “down”)● CTRL+L # clear screen 13
  14. 14. Standard I/O & piping● Redirect output to a file using “>”● Append output to a file using “>>”● Obrain input from a file using “<”● Redirect output as input to another process (piping) “|” 14
  15. 15. Servers 15
  16. 16. ssh access● Using password● Public/private key pair ssh user@35.231.23.120 -p5022 ( default 22) 16
  17. 17. Important paths/usr/local/project Root directory (capistrano convension)/var/log/ all important logs/etc/ system configuration files/etc/init.d/ startup scripts 17
  18. 18. Uploading/Downloading files● scp scr_file user@server.com:/dst_path/● wget http://www.akhbarak.net/traces.log.gz 18
  19. 19. Server Anatomy Web server MemcacheApplication server Indexer Database 19
  20. 20. WTF!! 20
  21. 21. WTF● Something wrong● Too few details● Admin/dev related 21
  22. 22. Identifying the problem● Browser/Firebug● Isolating the request● Logs – Application logs – Web server logs – Other logs● Rails console 22
  23. 23. System status● System load/CPU (top)● IO (iotop)● Memory (free -m, top)● Check processes (ps aux | grep ruby)● …. 23
  24. 24. Monitoring Tools 24
  25. 25. Newrelic.com● Multiple technologies● Performance analysis● Server monitoring● Traces of errors & slow requests 25
  26. 26. Thank You 26

×