30 September, 2014

Install Raspbian (Debian Wheezy) OS on Raspberry Pi using Ubuntu


Hope you have seen my earlier posts regarding the raspberry pi over this link.This  post is about setting up Raspberry pi with Debian Wheezy on it. I am assuming that you have a Ubuntu/Debian running laptop already available. For those who are not yet in this universe (I mean using windows) please follow this link

Get the raspbian OS image from the official website. You can get the files either by the torrent link or through the direct download link.


If your sd card already contains a linux distribution, follow the steps mentioned in this link to factory reset the card

  • Run df -h to see what devices are currently mounted.

  • If your computer has a slot for SD cards, insert the card. If not, insert the card into an SD card reader, then connect the reader to your computer.

  • Run df -h again. The new device that has appeared is your SD card. The left column gives the device name of your SD card; it will be listed as something like /dev/mmcblk0p1 or /dev/sdd1. Ideally if you are plugging your card into laptops card reader using it's adapter device label will be /dev/mmcblk0p1.On the other side if the card is connected to a usb card reader, device name shown will be /dev/sdb1 or /dev/sdc1 or /dev sdd1 etc... The last part (p1 or 1 respectively) is the partition number but you want to write to the whole SD card, not just one partition. Therefore you need to remove that part from the name (getting, for example, /dev/mmcblk0 or /dev/sdd) as the device for the whole SD card.

  • Now that you've noted what the device name is, you need to unmount it so that files can't be read or written to the SD card while you are copying over the SD image.

  • Run umount /dev/sdd1, replacing sdd1 with whatever your SD card's device name is (including the partition number).

  • If your SD card shows up more than once in the output of df due to having multiple partitions on the SD card, you should unmount all of these partitions.

  • In the terminal, write the image to the card with the command below, making sure you replace the input file if= argument with the path to your .img file, and the /dev/sdd in the output file of= argument with the right device name. This is very important, as you will lose all data on the hard drive if you provide the wrong device name. Make sure the device name is the name of the whole SD card as described above, not just a partition of it; for example sdd, not sdds1 or sddp1; or mmcblk0, not mmcblk0p1.

    cd /path/containing/extracted/OSimage/previously/downloaded

    sudo dd bs=4M if=2014-09-09-wheezy-raspbian.img of=/dev/sdd

  • Please note that block size set to 4M will work most of the time; if not, please try 1M, although this will take considerably longer.

  • The dd command does not give any information of its progress and so may appear to have frozen; it could take more than five minutes to finish writing to the card. If your card reader has an LED it may blink during the write process. To see the progress of the copy operation you can run sudo pkill -USR1 -n -x dd in another terminal. The progress will be displayed in the original window and not the window with the pkill command; it may not display immediately, due to buffering.

  • Run sync; this will ensure the write cache is flushed and that it is safe to unmount your SD card. 
  • Remove the SD card from the card reader.

     
Read rest of entry

17 August, 2011

setup lamp server on debian/ubuntu || the easiest & the best way


The LAMP server is the commonly abbreated for Linux Apache MySql PHP server. This is a platform where web pages can be build/test/run using linux.

So setting up your LAMP server includes installing all those above said packages and configuring them to work together.

You can use either terminal or synaptic package manager to install these packages [and should have a working internet connection]. Anyway we may have to use the terminal for configuring them. So better move with the Terminal [Applications > Accessories > Terminal] itself.

1. Install Apache server

------------------------------
Below command will install apache server in your system


$ sudo apt-get install apache2

when the installation finishes, test weather it's working by pointing your web browser[firefox / chrome . . . ] to the following web address.
http://localhost/  

You should see a folder entitled apache2-default/. Open it and you will see a message saying something like > "It works!"

2. Install PHP

- - - - - - - - - - - - -

copy-paste the command given below onto a terminal and hit the enter key.


$sudo apt-get install php5 libapache2-mod-php5

While PHP installation finishes, restart the apache web server to make it compatible with apache using the following command.


$ sudo /etc/init.d/apache2 restart

testing PHP

To ensure there are no issues with PHP let's give it a quick test run.

Step 1. In the terminal copy/paste the following line:



$ sudo gedit /var/www/test.php

This will open up a file called test.php.

Add the following line into the test.php, save and close the file.


  <?php
      phpinfo();
  ?>


Now open you're web browser and type the following into the web address:



http://localhost/test.php


Note : You can change the location of the Document root [by default it is /var/www/] by reading this article.

Install MySQL
- - - - - - - - - - - - - - 

open up the Terminal and then copy/paste this line:


sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql


install phpmyadmin
-------------------------

 

sudo apt-get install phpmyadmin

Now just restart Apache and you are all set!



sudo /etc/init.d/apache2 restart


That's enough! your LAMP server  is ready, and now you can can move up with your pretty codes >>
Read rest of entry

05 October, 2010

Changing Permissions with chmod

The chmod command lets you change the access permissions of files and directories. shows several chmod command lines and how access to the directory or file changes.

chmod 0700

The directory’s owner can read or write files in that directory as well as change to it. All other users (except root) have no access.

chmod 0711 
Same as for the owner. All others can change to the directory, but not view or change files in the directory. This can be useful for server hardening, where you prevent someone from
listing directory contents, but allow access to a file in the directory if someone already knows it’s there.

chmod go+r

Adding read permission to a directory may not give desired results. Without execute on, others can’t view the contents of any files in that directory.

chmod 0777

All permissions are wide open.

chmod 0000

All permissions are closed. Good to protect a directory from errant changes. However, backup programs that run as non-root may fail to back up the directory’s contents.

chmod 666

Open read/write permissions completely on a file.

chmod go-rw Don’t let anyone except the owner view, change, or delete the file.

chmod 644

Only the owner can change or delete the file, but all can view it.
Read rest of entry

Copying Remote Files with scp



To use scp to transfer files, the SSH service (usually the sshd server daemon) must be running on the remote system. Here are some examples of useful scp commands:






$ scp myfile francois@server1:/tmp/ 
Password: ******
Above code copies myfile to server1


$ scp server1:/tmp/myfile 
Password: ******
Copy remote myfile to local working directory. Use the -p option to preserve permissions and timestamps on the copied files:

$ scp -p myfile server1:/tmp/If the SSH service is configured to listen on a port other than the default port 22, use -P to indicate that port on the scp command line:

$ scp -P 12345 myfile server1:/tmp/
 
Connect to a particular port.To do recursive copies, from a particular point in the remote file system, use the -r option:

$ scp -r mydir francois@server1:/tmp/ 
Copies all mydir to remote /tmp .Although scp is most useful when you know the exact locations of the file(s) youneed to copy, sometimes it’s more helpful to browse and transfer files interactively.

Read rest of entry
 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger