LAMP WEB SERVER WITH WORDPRESS

  Learn to set up a LAMP (Linux, Apache, MySQL, PHP) stack on your Raspberry Pi and configure it to work as a web server. You’ll download and install WordPress and set up a basic website…

Source: LAMP WEB SERVER WITH WORDPRESS

How to NFS root on the raspberry pi


Top of Form

I’d like to start writing a few questionably useful guides for people. We’re going to start with this one cause I find it’s actually quite a handy thing to do.. This is probably for the slightly more experienced user.

I’ll probably be editing this a few times, just to make sure I get it reasonably right, and that the formatting isn’t terrible. Or to add/change the methods of doing things. There’s almost always more than one way to do something in Linux.

So you’ve got your raspberry pi with a 4GB SD card, or like me find yourself saddled with a bunch of otherwise nearly useless 2GB or smaller cards that are really slow. Good news! The raspberry pi really only needs a 64MB boot partition (and a bit of swap if you want). For this guide, I’m going to assume you’re using at least a 4GB card as it makes things somewhat easier. I’m also going to assume that you’re using reserved DHCP addresses for your raspberry pi and other things. I don’t recommend this for those using wireless, wired network only.

It can also make backing up and restoring them a snap. Should you ever find yourself wanting to fully run it off the SD card again, you can just as well copy it back later.

You’ll need a running NFS server to do this. It can be another raspberry pi if you want it to be. I’m not going to go over setting it up at this point. You’ll want to have gparted installed somewhere as well since we’ll be changing the partitioning of the SD card at the end.

 
 

Step 1: Write your raspbian image to the SD card, and do your initial boot and setup as you normally would. Make sure it all works.

 
 

Step 2: Install nfs-common. If it needs to upgrade anything while doing this then let it. We can save a dist-upgrade for later. Run:

sudo apt-get update

sudo apt-get install nfs-common

 
 

Step 3: We need to remove dphys-swapfile. This is a must. Swap generally expects direct access to the file (or partition even), and NFS prevents this. If you don’t do this the system will crash at some point when it starts swapping memory. Run:

sudo apt-get purge dphys-swapfile dphys-config

sudo update-rc.d -f dphys-swapfile remove

Then reboot. Next we need to check that no other swap devices are in use. Run “swapon -s”. You should get a single line like this:

Filename Type Size Used Priority

If that’s the case, you can go ahead and run “sudo rm /var/swapfile” to make sure the dphys-swapfile is gone.

 
 

Step 4: Check/edit /etc/sysctl.conf. This step involves upping vm.min_free_kbytes. When the first raspberry pis came out they had this set to something like 4MB or so. With 256MB RAM every little bit counted. However this seemed to be causing more issues with the network if you used it heavily. So, run “sudo nano /etc/sysctl.conf”. Scroll to the bottom. There will probably be a comment line “# rpi tweaks”. There will probably be a vm.swappiness=1 and a vm.min_free_kbytes line. If not add it:

vm.min_free_kbytes = 16128

This will try and make sure that when your system is busy it still has enough memory to do the things it needs to. Some people have set it to 24576, but I found my issues went away when set to 16128. You can up the swappiness to 40 if you want now as well. We’ll be re-adding swap in later.

 
 

Step 5: Remove the / partition from /etc/fstab. Open up “sudo nano /etc/fstab” find the line that looks like this and remove it:

/dev/mmcblk0p2 / ext4 defaults,noatime 0 1

 
 

Step 6: Copy the contents of the root partition on the SD card to your NFS server. Power off your raspberry pi, and plug it into a reader on your NFS server. This needs to be on a proper linux supported partition, don’t use something exFAT or NTFS.

Make a folder somewhere, you’ll have to decide this on your own. In my case, I’m running it off of some external 2TB drives I setup into a raid1 when I got them back from warranty repair. You can also set the permissions how you want, but you’ll notice the uids probably won’t match up (aside from root). Either way, your sequence of commands is going to look somewhat like this, with extra care on the cp arguments:

mkdir rpi-nfs1

chmod 777 rpi-nfs1

cd rpi-nfs1

sudo cp -rapv /mnt/<SD CARD ROOT LOCATION> .

 
 

Step 7: Add your export to NFS. We need to export the above folder we copied into, with the full path. Run “sudo nano /etc/exports” and add the following line with your corresponding reserved IP address in:

/mnt/external2tb/rpi-nfs1 <IP ADDRESS HERE>(rw,no_root_squash,async,no_subtree_check)

Save and exit. Then export it by running “sudo exportfs -rav”. Make sure it shows up. It’ll say something like this:

exporting <IP ADDRESS HERE>:/mnt/external2tb/rpi-nfs1

 
 

Step 8: Still with me? Still got that SD card inserted into your NFS server? Good. Now we’re going to edit some files on the boot partition of the SD card. MAKE SURE YOU’RE EDITING THE ONES ON THE SD CARD AND NOT THE COMPUTER YOU’RE USING. First file that needs some fixing up is /boot/cmdline.txt. This file is important, and it needs to all be on one line, no returns to make it look pretty.

Yours probably looks exactly like this:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

We now need to tell it we’re using NFS, and where it is, with a few other things. You’ll want to make yours look more like this:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/nfs nfsroot=<YOUR NFS SERVER IP>:/mnt/external2tb/rpi-nfs1,tcp ip=dhcp rootfstype=nfs smsc95xx.turbo_mode=N elevator=deadline rootwait

We’ve changed the root and the rootfstype. We also add in ip=dhcp so that the raspberry pi knows to get it’s IP by dhcp. We’ve also put in smsc95xx.turbo_mode=N, which is a fix for some issues the network chip has/had while under heavy loads. We want this thing rock solid when we’re done.

 
 

Step 9: Remove the / ext4 partition from the SD card, convert to swap if desired. You can skip this part if you want, but I recommend doing it. Open up gparted. Select your SD card. Select the 2nd, much larger partition. Click Partition->Format To>Linux-Swap. Once you think you’ve got it right, click the “Apply All Operations” checkmark, or select Edit>”Apply All Operations”

 
 

Step 10: Almost done. Panic and worry that you forgot something in the above steps.

 
 

Step 11: Unmount/eject the SD card from the computer you’ve been copying/editing on. Stick it into your raspberry pi and turn it on. If you’re lucky it should all start up and run just like before, except over the network now.

 
 

Step 12: What about that swap partition? Lets re-enable swap. Run “ls -l /dev/disk/by-id”. You’ll get an output like this:

lrwxrwxrwx 1 root root 15 May 28 15:14 49273d6c-2a19-4dbf-a7b5-58075bc6a1c2 -> ../../mmcblk0p2

lrwxrwxrwx 1 root root 15 May 8 15:40 C522-EA52 -> ../../mmcblk0p1

mmcblk0p2 should be the swap partition. Lets check. Run “sudo fdisk -l”. You should get something like this:

Device Boot Start End Blocks Id System

/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)

/dev/mmcblk0p2 122880 3788799 1832960 82 Linux swap / Solaris

Okay! Now we take that long hex number we got from the ls, and use that in /etc/fstab. That’s our UUID for the swap partition. Add the line to /etc/fstab, yours will have a different ID number, but otherwise it’s the same:

UUID=49273d6c-2a19-4dbf-a7b5-58075bc6a1c2 none swap sw 0 0

Once that’s in your fstab file, run “sudo swapon -a”. Then check it. Run “swapon -s”. You should see it’s now using the leftover space on the SD card as swap. Something like this, except this is from a 2GB card:

Filename Type Size Used Priority

/dev/mmcblk0p2 partition 1832956 0 -1

 
 

Step 13: All done. Run your sudo apt-get update, sudo apt-get dist-upgrade, sudo apt-get clean and enjoy your fancy new NFS root using raspberry pi. Check your disk usage by running “df -h”. You’ll now get something like this, the X’s replaced by your NFS server’s IP address.

Filesystem Size Used Avail Use% Mounted on

rootfs 1.8T 70G 1.7T 5% /

192.168.X.XXX:/mnt/external2tb/rpi-nfs1 1.8T 70G 1.7T 5% /

devtmpfs 87M 0 87M 0% /dev

tmpfs 19M 184K 18M 1% /run

tmpfs 5.0M 0 5.0M 0% /run/lock

tmpfs 395M 0 395M 0% /run/shm

/dev/mmcblk0p1 56M 19M 38M 34% /boot

Look at that! Suddenly I’ve got 1.7TB to work with now!

 
 

Feel free to complain that I should’ve written a proper guide on how to software raid & samba/nfs on the raspberry pi first. NFS/samba setups are boring, this is way more fun. So you get this one first.

edit: With the Jessie update you need to add ‘rw’ to your cmdline.txt after the ‘nfsroot=***’ bit. Otherwise it will mount it read only.

 

Reference:
https://www.reddit.com/r/raspberry_pi/comments/37n9tb/how_to_nfs_root_on_the_raspberry_pi/Bottom of Form

Raspberry Pi with NFS boot

 

Setting up the Raspberry Pi to boot from Root NFS

To assist with more rapid development, I prefer to mount the root filesystem from NFS.

Understanding the Raspberry Pi Boot Process details the bootloaders and files that are required to boot a Raspberry Pi.

I have a handful of 16 megabyte (yes, megabyte) MMC cards lying around that makes perfect boot media for this task.

Preparing the MMC

The Raspberry Pi will boot from either FAT32 or FAT16. The minimum volume size for FAT32 is 32 megabytes, hence if I’m to work with a 16 megabyte MMC, I must format the card with a FAT16 filesystem.

Partition the card using fdisk where /dev/sdb is your SD/MMC block device:

sudo fdisk /dev/sdb

You will now be presented with a menu. First select p to print the current partition table, ensuring you have selected the right disk.

If the disk is correct, delete any existing partitions.

Now select n to add a new partition. Select primary partition and any other defaults.

The default partition will now be set for linux. Select t to change a partition’s system ID and enter 4 (FAT16 <32M)

Finally, write the partition table to disk and exit by selecting w.

Now format the card:

sudo mkdosfs /dev/sdb1

Mount the new file system, so you can add the required files:

sudo mount -t msdos /dev/sdb1 /media/card

Copy the following files over to your freshly formatted SD/MMC card:

bootcode.bin

start.elf

config.txt

cmdline.txt

kernel.img

You can obtain the files from an existing Raspberry Pi installation, or you can download them from the Raspberry Pi Git Repository:

wget https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin

wget https://github.com/raspberrypi/firmware/raw/master/boot/start.elf

wget https://github.com/raspberrypi/firmware/raw/master/boot/kernel.img

Create a cmdline.txt file containing the following parameters:

console=ttyAMA0,115200 root=/dev/nfs rw nfsroot=192.168.0.251:/home/cpeacock/export/rootfs ip=192.168.0.250:::::eth0 rootwait

The config.txt file can be omitted if you are using default parameters.

Prepared Image

Below is a prepared FAT16 image. It can be restored using the Win32 Disk Imager

Reference from: http://wiki.beyondlogic.org/

Cherokee Web server on Raspberry Pi

022716_0841_CherokeeWeb1.png

Why to go for another web server, if there are lot of web servers we discussed and available in market. The simple answer to that question is, embedded light weight web server with IoT support.

In this topic, I am not going to say a again from scratch on how to use raspberry pi. If you are at really having a fresh Raspberry pi board and want to do this exercise.Please read my blog on “getting started with raspberry pi for Windows users”

Installation Guide

First of all if you are interested in installation of Cherokee web server, go the reference at the end of this document. Do remember to read the dependencies for installation of Cherokee. After installation of Cherokee the most important work is to provide the virtual path of file system.

How it works:

Basically after successful installation of server need to do a command

sudo Cherokee –admin –b

Keep the user name and password to enter on webpage.

During configuration Cherokee cannot able to write into default path. So reason is simple as pi user do not have the credential to access. So to avoid that type of issues two ways can be adapted, 1st option is preferable.

Option:1

Make all default paths with in Pi user, I have used the following path

/home/pi/New1

Option:2

Provide credential to Cherokee by login as root user.

/usr/local/etc/cherokee/

Now using putty, I typed the following command at terminal. Then for admin the OTP will be generated.

 pi@raspberrypi ~ $ sudo cherokee-admin -b

[01/06/2013 06:37:44.734] (warning) rrd_tools.c:121 – Could not find the

    rrdtool binary. | A custom rrdtool binary has not been defined, and the

    server could not find one in the $PATH.

 [01/06/2013 06:37:44.734] (warning) socket.c:479 – IPv6 support is disabled.

    Configuring for IPv4 support only. | The issue seems to be related to your system.

Cherokee Web Server 1.2.99 (Nov  4 2012): Listening on port ALL:9090, TLS

disabled, IPv6 enabled, using epoll, 4096 fds system limit, max. 2041

connections, caching I/O, single thread

 Login:

  User:              admin

  One-time Password: kgEF1C7KMv1fCYNS

 Web Interface:

  URL:               http://localhost:9090/

 The next step is open internet explorer, type the IP address along with port 9090.

If everything is OK, then the server will start and then the button will change to stop server.

After that I have copied all web support package of controller /home/pi/New1

Then using internet explorer, I have entered the IP address of device.

Note: Remember the default port for web server is 80

Then the web pages start loading without any issues as shown below. I have extended my test by using chrome, firefox and the things are quite normal.

I had the initial issue in firefox that the configuration file was not found. But using internet explorer, I could able to resolve that issue.

First I have used the following command:

cherokee-admin –b

The result is shown below.

Can you able to guess the issue? It is very simple only you need to run the cherokee admin as power user. That means the command should like this:

sudo cherokee-admin –b

Have more question? Write back to me or comment.

Crunch Password list generation in Kali Linux

In this tutorial we will be using the Crunch Password list generation tool in Kali Linux. Crunch is an easy to use tool for generating a custom made password list used for brute force password cracking. Crunch comes as a standard tool in Kali Linux. This tutorial shows you how easy it is to generate a password list containing all combinations of 4 letters, 5 letters and a password list containing 5 letters followed by a year. You can also use Crunch to generate password lists based on default router passwords as demonstrated in a few other tutorials. UPC Broadband routers use 8 capital letters as default password for Wifi and TP Link routers use the 8 digit default WPS PIN. Both can be easily generated with Crunch.

Crunch password list generation

Let’s use the following command to have Crunch generate a wordlist containing all combinations of 4 letters:

crunch 4 4 ABCDEFGHIJKLMNOPQRSTUVWXYZ -o /root/Desktop/wordlist.txt

The generated Crunch password list has a size of 2 MB

Let’s use the following command to have Crunch generate a wordlist containing all combinations of 5 letters:

crunch 5 5 ABCDEFGHIJKLMNOPQRSTUVWXYZ -o /root/Desktop/wordlist.txt

The generated Crunch password list has a size of only 67 MB

The next wordlist we are going to make is a wordlist containing all possible combinations with 5 letters follow by 1980. The 1980 represents a year of birth for instance, commonly used as a password in combination with a name:

crunch 8 8 ABCDEFGHIJKLMNOPQRSTUVWXYZ
-t @@@@1980 -o /root/Desktop/wordlist.txt

The generated Crunch password list has a size of only 3 MB.

Let us take another example where we need to create India cellphone number wordlist starting from 9000000000 to 9999999999

crunch 10 10 0123456789 -o /root/Desktop/wordlist.txt -s 9000000000

The generated Crunch password list has a size of 10 GB. After compression it became 2 GB.

Say IP address of Raspberry-Pi at startup

Continue reading

Raspberry Pi Zero

clip_image001

 

Now a $5 Raspberry Pi lunched. Yes it is but you may need to pay more depending on your country and distributer.

Before you go for it you must know what are the features available with this $5 mini computer.

Raspberry Pi Zero is a full-fledged member of the Raspberry Pi family.

Raspberry Pi Zero features:

·       A Broadcom BCM2835 application processor

·       1GHz ARM11 core (40% faster than Raspberry Pi 1)

·       512MB of LPDDR2 SDRAM

·       A micro-SD card slot

·       A mini-HDMI socket for 1080p60 video output

·       Micro-USB sockets for data and power

·       An unpopulated 40-pin GPIO header

·       Identical pinout to Model A+/B+/2B

·       An unpopulated composite video header

·       Our smallest ever form factor, at 65mm x 30mm x 5mm

Raspberry Pi Zero runs Raspbian and all your favourite applications, including Scratch, Minecraft and Sonic Pi.

I have got a nice comparison chart from element 14 which can be useful for buyers who are looking for a new Pi Zero.

Raspberry Pi Zero, Pi 2 Comparison:

 

 

Raspberry Pi 2 Model B

NEW! Raspberry Pi Zero

Dimensions

85mm x 56mm x 21mm

65mm x 30mm x 5mm

Chip

Broadcom BCM2836 ARMv7 Quad Core Processor

Broadcom BCM2835 ARMv6 SoC full HD multimedia applications processor

CPU

900 MHz Low Power ARMv7 Quad Core Processor

1 GHz Low Power ARM1176JZ-F Applications Processor

GPU

Dual Core VideoCore IV® Multimedia Co-Processor

Dual Core VideoCore IV® Multimedia Co-Processor

RAM

1GB SDRAM @ 450 MHz

512 MB SDRAM @ 400 MHz

Storage

MicroSD

MicroSD

USB 2.0

4x USB Ports

1x Micro USB Port

Ethernet

1x 10/100mb Ethernet RJ45 Jack

None

Video Connections

HDMI, Composite RCA (shared with audio jack)

HDMI

Supported Resolutions

640×350 to 1920×1200, including 1080p, PAL & NTSC standards

640×350 to 1920×1200, including 1080p, PAL & NTSC standards

Audio

Multi-Channel HD Audio over HDMI, Stereo from 3.5 mm jack

Multi-Channel HD Audio over HDMI

Operating Systems

Raspbian, RaspBMC, Arch Linux, Risc OS, OpenELEC, Pidora

Raspbian, RaspBMC, Arch Linux, Risc OS, OpenELEC, Pidora

Power

5V micro USB input. 800mA rating

5V micro USB input. 160mA rating

GPIO

40

40 pin (unpopulated)

Other Connectivity

1x CSI-2 for Raspberry Pi camera modules

1x DSI for Raspberry Pi displays

None

Power Source

1x Micro-USB

1x Micro-USB

Highlights

No more buffer face – boots up Raspbian in less than half the time as the Model B+

More power for your favourite projects – create Space Progammes, Time Lapse Videos, GPS tracking, HD audio and lots more with a full ecosystem of supporting accessories.

Build your own workstation – create and manage your documents and spreadsheets with ease using LibreOffice™

The 40 pin GPIO is unpopulated providing the flexibility to use only the connections your solution requires.

Power rating of just 160mA even when connected to a 1080P display, making this the most efficient Raspberry Pi to date.

1 Micro USB “on the go” data port for linking to accessories and peripherals like an external USB hub.

  

Raspberry Pi B+, A+ Comparison Chart:

 

 

Raspberry Pi 1 Model B+

Raspberry Pi 1 Model A+

Dimensions

85mm x 56mm x 17mm

65mm x 56mm x 12mm

Chip

Broadcom BCM2835 SoC full HD multimedia applications processor

Broadcom BCM2835 SoC full HD multimedia applications processor

CPU

700 MHz Low Power ARM1176JZ-F Applications Processor

700 MHz Low Power ARM1176JZ-F Applications Processor

GPU

Dual Core VideoCore IV® Multimedia Co-Processor

Dual Core VideoCore IV® Multimedia Co-Processor

RAM

512 MB SDRAM @ 400 MHz

256 MB SDRAM @ 400 MHz

Storage

MicroSD

MicroSD

USB 2.0

4x USB Ports

1x USB Port

Ethernet

1x 10/100mb Ethernet RJ45 Jack

None

Video Connections

HDMI, Composite RCA (shared with audio jack)

HDMI, Composite RCA (shared with audio jack)

Supported Resolutions

640×350 to 1920×1200, including 1080p, PAL & NTSC standards

640×350 to 1920×1200, including 1080p, PAL & NTSC standards

Audio

Multi-Channel HD Audio over HDMI, Stereo from 3.5 mm jack

Multi-Channel HD Audio over HDMI, Stereo from 3.5 mm jack

Operating Systems

Raspbian, RaspBMC, Arch Linux, Risc OS, OpenELEC, Pidora

Raspbian, RaspBMC, Arch Linux, Risc OS, OpenELEC, Pidora

Power

5V micro USB input. 600mA rating

5V micro USB input. 200mA rating

GPIO

40

40

Other Connectivity

1x CSI-2 for Raspberry Pi camera modules

1x DSI for Raspberry Pi displays

1x CSI-2 for Raspberry Pi camera modules

1x DSI for Raspberry Pi displays

Power Source

1x Micro-USB

1x Micro-USB

Highlights

Improved power management which improves USB support and allows for high-drain devices such as external USB hard drives.

Larger bank of accessible GPIO ports compared to Model B board allows for direct hardware device control.

Smaller, compact design

Works well as an introductory educational tool

Suitable for a smaller scale electronics project that requires standard IO ports

Minimalistic design assists in pick and choosing devices, helps  reduce overall power consumption

HAT Compatible

 

Follow Me:

clip_image002[4]clip_image004[4]clip_image006[4]clip_image008[4]

 

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,