***************************** REFERENCE *************************************** * Date: 4/20/2016 By:Jeff Manross Email:jeffmanross@gmail.com * ***************************** REFERENCE *************************************** * http://aryo.lecture.ub.ac.id/configure-timezone-settings-on-raspberry-pi-raspbian-wheezy/ * http://www.linuxreaders.com/2009/07/nconf-installation-configuration.html * http://myliteraturetechlife.com/install-nconf-web-interface-for-nagios-on-debianubuntu/ * http://digitalcardboard.com/blog/2010/08/24/nagios-and-nconf-on-ubuntu-10-04-lucid-lynx/ * https://www.raspberrypi.org/documentation/linux/filesystem/backup.md * http://vanheusden.com/java/ScanToNag/ * http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html * http://www.raspberrypi-spy.co.uk/2015/05/using-an-i2c-enabled-lcd-screen-with-the-raspberry-pi/ * https://bitbucket.org/MattHawkinsUK/rpispy-misc/raw/master/python/lcd_i2c.py * * ***************************** REFERENCE *** WEBCAM PICTURE OPTIONS ************ * http://manpages.ubuntu.com/manpages/lucid/man1/fswebcam.1.html * https://www.raspberrypi.org/learning/webcam-timelapse-setup/worksheet.md * https://www.raspberrypi.org/documentation/usage/webcams/README.md * https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=79508 * ***************************** REFERENCE *************************************** lets start off and assume that we are running on a: 192.168.1.? if you are not on 192.168.1.? then change all(ctrl-H) 192.168.1. to your network. lets also assume all passwords will be: abc123! if you do not want passwords of abc123! then change all(ctrl-H) abc123! to your password. ************ STEP 1 - initial setup, static local ip address, set time zone and load updates A01-Load Pi Image to SD Card A02-insert SD Card in to Pi and boot (turn it on) (watch the boot up and see what ip is assigned for step 103 below) go through initial config with all defaults If you installed - 2016-03-18-raspbian-jessie then run terminal window A02-1-sudo nano /etc/ssh/sshd_config change 'PermitRootLogin without-password' to 'PermitRootLogin yes' ctrl-x save = yes A02-2-raspi-config change boot option to command line .... continue as follows .... 1. - Option 1 - Expand File System 2. - Option 2 - Change User Password to: abc123! 3. - Option 8 / A2 - Change Device Name **** IF YOU WANT I2C LCD (section 'J' below) 4. - Option 8 - Advanced Options A7 - Enable I2C - YES Load Kernel by Default - YES 5. - Finish and Reboot PI A03-ssh to ipaddress (192.168.1.?)(from step A02 above) I use putty.exe available here: ****** http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html logon as pi / raspberry (or whatever you set it as in the setup step #A02 above) A04-sudo passwd root change to 'abc123!' A05-logout A06-ssh to ipaddress (192.168.1.?) logon as root (hit enter) password is abc123! A07-apt-get update A08-apt-get upgrade answer "Y" to install updates A09-shutdown -r now A10-ssh to ipaddress (192.168.1.?) logon as root (hit enter) password is abc123! A11-nano /etc/network/interfaces change dhcp to static in the following line: iface eth0 inet dhcp add the following after the above line: iface eth0 inet static address 192.168.1.? netmask 255.255.255.0 gateway 192.168.1.1 network 192.168.1.0 broadcast 192.168.1.255 ctrl-x save = yes A12-nano /etc/resolv.conf make sure server is some public DNS server / if not change/add 8.8.8.8 (GOOGLE DNS) ctrl-x save = yes A13-sudo dpkg-reconfigure tzdata A14-**** if you want to remove the RaspberryPi Logo A15-1 nano /boot/cmdline.txt add "logo.nologo" to the front of the command line. ex: logo.nologo dwc_otg.lpm_...-.....rootwait ctrl-x save = yes A16-shutdown -r now ************ STEP 2 - LAMP - load perl, apache web server and core defaults A17-ssh to ipaddress (192.168.1.?) logon as root (hit enter) password is abc123! A18-apt-get install apache2 answer "Y" to install A19-apt-get install mysql-server mysql-client answer "Y" to install set password: abc123! A20-apt-get install php5 php5-mysql perl python-mysqldb answer "Y" to install A21-apt-get install libdbi-perl libdbd-mysql-perl libapache2-mod-php5 gawk phpmyadmin answer "Y" to install use: apache2 (use space bar to select) then enter set passwords: abc123! A22-shutdown -r now AFTER REBOOT OPEN A BROWSER ON YOUR PC AND SURF TO: http://192.168.1.??? (or whatever you set it as in the setup step #A02 above) YOU SHOULD GET A MESSAGE LIKE BELOW: *************************************************************** It works! This is the default web page for this server. The web server software is running but no content has been added, yet. *************************************************************** PLEASE EDIT THE FOLLOWING FILE BEFORE PLACEING YOUR SERVER LIVE ONLINE /var/www/html/index.html **** IF you want a different folder for your default web site nano /etc/apache2/sites-available/000-default.conf change /var/www/html to /???/???/???? ctrl-x save = yes sudo service apache2 restart *************************************************************** *** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** *************************************************************** **** if you want samba shares - file sharing - edit default web B01-sudo apt-get install samba samba-common samba-common-bin B02-nano /etc/samba/smb.conf *************************************************************** ** add the following at the bottom of the file, and save *************************************************************** [WebFiles] comment = Shared Files path = /var/www browseable = Yes writeable = Yes guest ok = yes create mask = 0777 directory mask = 0777 ctrl-x save = yes B03-sudo useradd webadmin B04-sudo passwd webadmin set password: abc123! B06-sudo smbpasswd -a webadmin set password: abc123! B07-sudo /etc/init.d/samba reload B08-chmod 0777 /var/www (or whatever path you put above on the share) B09-service samba restart *************************************************************** *** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** *************************************************************** **** if you want ftp ability to send or receive files C01-sudo apt-get install ftp *************************************************************** ** bash script example *************************************************************** USRID = change_this_to_ftp_user USRPASS = change_this_to_ftp_password FILNAME = change_this_to_file.extension ftp -v -n www.????????.com < /var/www/DATABASENAME.sql D03-using ftp or windows or put/get copy the the file /var/www/DATABASENAME.sql to a location on the new server *************************************************************** ** RESTORE *************************************************************** D04-pv /var/www/DATABASENAME.sql | mysql -uroot -pabc123! DATABASENAME *************************************************************** *** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** *************************************************************** ******* if you want to auto find devices on your network E01-cd /download E02-wget http://vanheusden.com/java/ScanToNag/ScanToNag-0.2.jar E03-java -jar ScanToNag-0.2.jar --range 192.168.1.0/24 --emit-templates --timeout 50 --contacts unix-admins --hosts-file myhosts.conf --services-file myservices.conf --skip-reserved E04-nano myhosts.conf *************************************************************** ** nice list of active ip addresses on the local network *************************************************************** E05-nano myservices.conf *************************************************************** ** nice list of services for addresses on the local network *************************************************************** *************************************************************** *** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** *************************************************************** ******* if you want to add nagios network monitor with nconf F01-apt-get install nagios3 nagios-plugins nagios-nrpe-plugin set passwords: abc123! F02-sudo mkdir /etc/nagios3/import F03-sudo mkdir /etc/nagios3/global F04-sudo mkdir /etc/nagios3/Default_collector F05-sudo cp -r /etc/nagios3 /etc/nagios3.backup F06-nano /etc/nagios3/nagios.cfg comment out all with '#': cfg_dir= cfg_file= Add cfg_dir=/etc/nagios3/global cfg_dir=/etc/nagios3/Default_collector ctrl-x save = yes F07-shutdown -r now F08-ssh to ipaddress (192.168.1.?) logon as root (hit enter) password is abc123! F09-mkdir /download F10-cd /download F11-wget http://downloads.sourceforge.net/project/nconf/nconf/1.3.0-0/nconf-1.3.0-0.tgz F12-sudo tar zxvf nconf-1.3.0-0.tgz -C /var/www/ F13-sudo chown -R www-data:www-data /var/www/nconf ******* in a browser open phpmyadmin F14-http://192.168.1.?/phpmyadmin/ logon as root (hit enter) password is abc123! click privileges or users tab click add a new user user name: nconf host: localhost password: nconf retype: nconf *** DO NOT CLICK GENERATE select create datebase with same name and grant all privileges click on "Check All" Click Create User Button at Bottom ******* back in the ssh window F15-cd /var/www F16-chmod 777 nconf -R F17-sudo chown -R www-data:www-data /var/www/nconf F18-shutdown -r now F19-ssh to ipaddress (192.168.1.?) logon as root (hit enter) password is abc123! ******* in a browser open nconfig F20-http://192.168.1.?/nconf/ install nconf DBHOST localhost DBNAME nconf DBUSER nconf DBPASS nconf change NAGIOS_BIN: /usr/sbin/nagios3 AUTH_ENABLED: TRUE AUTH_TYPE: file file_admin_password: abc123! click finish ******* back in the ssh window F21-cd /var/www/nconf F22-rm -rf INSTALL INSTALL.php UPDATE UPDATE.php F23-nano /var/www/nconf/ADD-ONS/deploy_local.sh change: OUTPUT_DIR="/var/www/html/nconf/output/" NAGIOS_DIR="/usr/local/nagios/etc/" to: OUTPUT_DIR="/var/www/nconf/output/" NAGIOS_DIR="/etc/nagios3/" . . . /etc/init.d/nagios3 reload ctrl-x save = yes F24-chmod +x /var/www/nconf/ADD-ONS/deploy_local.sh F25-/etc/init.d/nagios3 reload F26-sudo crontab -e (option 2 if prompted) add at end: * * * * * /var/www/nconf/ADD-ONS/deploy_local.sh F27-shutdown -r now F28-******* in a browser open/refresh http://192.168.1.?/nconf F29-******* in a browser open/refresh http://192.168.1.?/nagios3 *************************************************************** *** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** ADD ONS ** *************************************************************** ******* if you want add webcam stuff that ftps picture every hh:mm:ss? G01-ssh to ipaddress (192.168.1.?) logon as root (hit enter) password is abc123! G02-sudo apt-get install fswebcam G03-sudo apt-get install ftp G04-sudo dpkg-reconfigure tzdata G05-cd /usr G06-mkdir webcam G07-cd webcam G08-nano capture_and_ftp.sh ******************** highlight from here down to there and copy paste into webcam.sh #!/bin/bash DATE=$(date +"%Y%m%d-%H%M%S") FOLDERDATE=$(date +"%Y%m%d") MYSITE=MobileCam- FILEOUT=$MYSITE$DATE cd /usr/webcam/audit mkdir $FOLDERDATE fswebcam -r 800x600 /usr/webcam/audit/$FOLDERDATE/$FILEOUT.jpg cp /usr/webcam/audit/$FOLDERDATE/$FILEOUT.jpg /webcam/$MYSITE.jpg ftp -v -n www.MYWEBSITE.com <