Pages:
Author

Topic: Super Tutorial Raspberry Pi+Raspbian+CGMiner+TightVNC+WIFI at boot - page 2. (Read 18650 times)

full member
Activity: 238
Merit: 100
Hey man thanks for this...was really helpful in getting things primed for some of those k1 miner's I plan to order.
newbie
Activity: 37
Merit: 0
Hi, I'm gonna make a super tutorial to make an automatic miner using a Raspberry Pi and a USB ASIC, in my case I'm gonna make the tutorial for a Butterfly Labs ASIC, but will be almost the same for other kind of USB devices.

When you finish the tutorial, the Raspberry Pi and the ASIC will mine in automatic mode, will be plug and mine, if you have a power outage don't worry and if something goes wrong, unplug, plug and ready.

Before to start the tutorial, is important to know the Raspberry Pi IP and to give an static IP, the best way is with your router.


Possible software we need:

- Raspbian, OS .img file (http://downloads.raspberrypi.org/images/raspbian/2013-05-25-wheezy-raspbian/2013-05-25-wheezy-raspbian.zip)

- SD Formatter, to format the SD (https://www.sdcard.org/downloads/formatter_4/)

- Win32imager, to copy the .img file to the SD (http://sourceforge.net/projects/win32diskimager/)

- Putty, SSH client to connect to the Raspberry Pi (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html?)

- TightVNC, client to connect to the Raspberry Pi desktop (http://www.tightvnc.com/download.php)


Tutorial steps

1- Open Putty or any other SSH client and write the Raspberry Pi IP.

2- You will get a security alert, don't worry, say "Yes".

3- Login as: pi

4- Password: raspberry

5- The first thing to do is to change the default username and password:
   - sudo adduser "youruser" --force-badname (without quotation marks)
   - Will ask for the password for that new user two times and other data
   - To give permissions to the new user: sudo visudo
   - Will open the file sudoers.tmp
   - Under the line: root ALL=(ALL:ALL) ALL add: "youruser" ALL=(ALL:ALL) ALL (without quotation marks)
   - At the last line change: pi ALL=(ALL) NOPASSWD: ALL for: "youruser" ALL=(ALL) NOPASSWD: ALL (without quotation marks)
   - CTRL+X to exit, Y to save followed by enter
   - Now we can use sudo with the new user, to check it, use: su "youruser" (without quotation marks) to change to the new user, then: sudo raspi-config, if you can open the configuration tool, the new user is ok, close the configuration tool.
   - Reboot using: sudo reboot
   - Login with the new user
   - Now we are going to erase the user "pi" and the files of this user with the command: sudo deluser --remove-all-files pi
   - Now we have our user ready and the user "pi" doesnt' exist.

6- The next is to update the system with these steps:
   - sudo aptitude update and wait until finish
   - sudo aptitude upgrade Will ask "Do you want to continue?", "Y" to say Yes and wait until finish again
   - Reboot using: sudo reboot

7- The next is to set a few things with the Configuration Tool with these steps:
   - To open the configuration too: sudo raspi-config
              - Activate "Expand Filesystem" to use all the SD card
   - "Internationalisation Options" to change the language, timezone and keyboard layout
   - "Advanced Options"-"Hostname" to set the visible name of the Raspberry Pi on the network.
   - Reboot using: sudo reboot

8- The next is to activate the Wifi network
   - To check if the Raspberry Pi is detecting the USB dongle, use the command: sudo lsusb You should see something similar to this "Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter" but will change depending of the model you connect.
   - Now we need to install the tool to set the wifi parameters using: sudo aptitude install wicd-curses Will ask "Do you want to continue?", "Y" to say Yes and wait until a blue screen, press space to select and enter to add your user to the netdev group and wait until finish
   - To open the tool, use the command: sudo wicd-curses
   - Move the cursor to your wifi network
   - Shift+P to go to Prefs
   - Check "Wireless interface", if it’s empty, write "wlan0" (Without quotation marks)
   - Press F10
   - Shift+R to refresh and see your wifi if you had to write "wlan0"
   - Move the cursor to your wifi
   - Right arrow to go to config
   - You can set here a static IP, but I prefer to set the static IP in my router
   - Activate Automatically connect to this network
   - Key: (write the wifi password)
   - Press F10
   - Shift+C to connect and if you obtain an IP everything is working fine, here, you will lose the connection, use the new IP for the wifi connection and connect with Putty again.
   - Login
   - Shift+Q to quit
   - Turn off using: sudo halt
   - Disconnect the ethernet cable and turn on the Raspberry Pi again, from now should work with wifi
   - From now, connect to the Raspberry Pi using the new Wifi IP

9- Now we are going to install TightVNC
   - Use the command: sudo aptitude install tightvncserver Will ask "Do you want to continue?", "Y" to say Yes and wait until finish
   - To start TightVNC use: tightvncserver
   - Will ask for a password to connect to the remote desktop, it can be different to the Raspberry Pi password, write the password two times
   - Wil ask "Would you like to enter a view-only password?",  "N" to say NO to have a total control of the remote desktop.
   - To autostart TightVNC every time we turn on the Raspberry Pi, we have to edit the file rc.local, using the command: sudo nano /etc/rc.local
   - Now, before the line "exit 0" add the line: sudo -u "youruser" /usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -dpi 100 (The user is without quotation marks, "geometry" is to set the resolution of your screen, "depth" is to set the color depth and "dpi" is to set the font size) so adjust these parameters to your needs.
   - CTRL+X to exit, Y to save followed by enter

10- The last step is to install the miner, CGMiner seems to work very well with the Raspberry Pi so these are the steps:
   - Before to install CGMiner we need to install this dependencies: sudo aptitude install git autoconf libtool libcurl4-openssl-dev libncurses5-dev pkg-config yasm make libusb-1.0-0-dev Will ask "Do you want to continue?", "Y" to say Yes and wait until finish.
   - Now we can start installing CGMiner:
      - git clone git://github.com/ckolivas/cgminer.git cgminer
       - cd cgminer
       - ./autogen.sh
       - export LIBCURL_CFLAGS='-I/usr/include/curl'
       - export LIBCURL_LIBS='-L/usr/lib -lcurl'
       - ./configure --enable-bflsc
       - make
       - sudo make install
   - The last step is to autostart CGMiner every time we turn on the Raspberry Pi:
      -We need to edit autostart with this command: sudo nano /etc/xdg/lxsession/LXDE/autostart
      -At the end add the line: @/usr/bin/lxterminal --geometry=90x35 -e cgminer (The parameter "geometry" is to set the size of CGMiner, so adjust the parameter to your needs)
      -Reboot using: sudo reboot

11- Install TightVNC on your computer
   - Write your Raspberry Pi IP
   - Will ask for the password of TightVNC
   - If everything is ok, you will see the Raspberry Pi desktop and CGMiner open waiting for the server details.
   - Write the URL
   - Write the username
   - Write the password
   - Now will start to mine, but we need to save the configuration file:
      - "S" to go to settings
      - "W" to write the config file
      - "Enter" to save the default "cgminer.conf"
      - "Space" to clean the screen

12- Now everything will work automatic
   - If you need to stop CGMiner, use que key "q"
   - If you need to reboot the Raspberry Pi, use: sudo reboot
   - If you need to turn off the Raspberry Pi, use: sudo halt
   - If you need to modify the config file "bfgminer.conf", open the "File Manager", "View"-"Show Hidden" and click to your user, you will see a folder ".cgminer", and inside you have the file, don't mistake with the folder without "dot".


If you like this post, buy me a beer Wink BTC: 1HFuxCE6WLL4Ct2DDiiX8C9eNnwBhARueh
Pages:
Jump to: