Tutorial: Using LeMaker Guitar to build NAS home server

6 4727
Edited by tony_zhang at Sun Sep 27, 2015 23:19

Using LeMaker Guitar to build NAShome server

The main function of the NAS home server
1File server: Usesamba to realizethefile sharing.
2 Downloadmachine:Usearia2c to realize the automatic download.
3 Streaming mediaserver:DLNA realize the use of computer or mobile phone playing the mediafiles that were placed in the sharingdirectory.
The steps are as follows.
1      Preparation work
1.1  Write the OS image fileRaspbian for LeMaker Guitar
1.2The preparation of hardware
(1)Use the power supply to supply power for the hard drive
(2)Connect the hard drive to the USB on theLeMaker Guitar by conversion line
(3)Plug in an RJ-45 Ethernet
(4)Plugging in the mains adapter power on the LeMaker Guitar.
1.3  Formatthe hard driveto create a new partition and mount the root directory to thehard drive
(1)Format the hard drive to create a newpartition
Run the sudo fdisk /dev/sda command. Use the o command todelete all partition of hard drive and use the n commandto add one new partition. Use the w command to savechange.
Run the sudo mkfs.ext4 /dev/sda1 command to format the new created partition ofhard drive as ext4.
(2) Mount the root directory to your hard drive
When we mount the root directory to the hard drive, the file system will start in the hard drive. This setting is a good way to protect LeMakerGuitar, when we need a long time to use the system .Specific methods are as follows
Create a temporary directory inthe root directory
  1. mkdir temp
  2. sudo fdisk –l
Copy the Code
Mount the /dev/mmcblk0p2 to the temp directory
  1. sudo mount /dev/mmcblk0p2  /temp
Copy the Code
Copy the file system to the hard drive partition
  1. sudo  mount /dev/sda1  /mnt
  2. cp –aP/temp /mnt
Copy the Code

Edit the /media/misc/uEnv.txt,
  1. sudo nano uEnv.txt
Copy the Code

Change the contentroot=/dev/mmcblk0p2 as follow
  1. root=/dev/sda1
Copy the Code

1.4  Close the GUI
  1. sudonano /etc/X11/default-display-manager
Copy the Code

Add false in the file
Reboot the systemthen graphical interface is no longer present.Automatically runin the CUI mode when the system reboot. The machine does not need to usethe GUI.Thegraphical interfacefor the LeMaker Guitar was closed to save computational resources.
2Createa file server
Use the file server can achieve LAN file sharing. Through this function we can upload files to the shared directory or download files from the shared directory.Here we use the samba software to realize our LANsharing.
2.1Setup static IP
  1. sudo nano /etc/network/interfaces
Copy the Code

Change the iface eth0 inet dhcp as follow
  1. iface eth0 inet static
Copy the Code

Add the content as follow
  1. address
  2. netmask
  3. gateway
Copy the Code

Andthen delete iface default inet dhcp
Here thestatic IP is set to Restart the network or reboot the system to finish it.
  1. sudo  /etc/init.d/networking  restart
Copy the Code

2.2 Installation of samba services
  1. sudo apt-get update
  2. sudo apt-get install samba
  3. sudo apt-get installsamba-common-bin
Copy the Code

2.3Add user and create the download directory
  1. sudouseradd maker
Copy the Code

To set a password for the new user, this is set to 123
  1. sudo passwd maker
  2. sudo mkdir/aria2download/download
  3. sudo chown –R maker/aria2download/download
Copy the Code

2.4Editthe samba configuration file
  1. sudo nano /etc/samba/smb.conf
Copy the Code

To find out the security = user and delete the symbol#in front of the sentence.
Add the content at the end of the file.
  1. [aria2share]
  2. comment=my family’s share
  3. path=/aria2download/download
  4. valid users=maker
  5. public=no
  6. writable=yes
  7. browseable=yes
  8. create mask=0777
  9. directory mask=0777
Copy the Code

Aria2share is the sharing file's name that we can see on the computer
2.5Add Samba user
Here we set Samba password is 123
  1. sudo smbpasswd  -a maker
  2. sudo service samba restart
Copy the Code

So far we have establishedthe file server based on samba.Type the Winkey+R and input our IP address of the server.Then we will see our sharing file on the computer.On the mobilephone use software ES file explorer to view the sharing file. In mynetwork page of the ES file explorer click the newoption and input thepath of our sharing file likeIP/sharing filenametheninput username with password. Here I input User name is makerand password is 321.We can manage our shared file in our phone now.
3Download machine
3.1Set up aria2
(1)Install aria2
  1. sudo apt-get install aria2
Copy the Code

Create a new directory and file
  1. sudo mkdir /etc/aria2
  2. sudo touch /etc/aria2/aria2.session
Copy the Code
(2) To configure the aria2
  1. sudo nano /etc/aria2/aria2.conf
Copy the Code
Edit /etc/aria2/aria2.conf. The meaning of thecontent you can refer thearia2 manual from
  1. dir=/aria2download/download               
  2. input-file=/etc/aria2/aria2.session
  3. max-concurrent-downloads=20
  4. continue=true
  5. lowest-speed-limit=0
  6. max-connection-per-server=5
  7. min-split-size=10M
  8. split=5
Copy the Code

  1. bt-enable-lpd=true
  2. bt-max-open-files=100
  3. bt-max-peers=55
  4. bt-min-crypto-level=plain
  5. bt-require-crypto=true
  6. follow-torrent=true
  7. listen-port=6881-6999
  8. max-overall-upload-limit=0
  9. max-upload-limit=0
  10. seed-ratio=1
  11. seed-time=120
Copy the Code

  1. enable-rpc=true
  2. rpc-allow-origin-all=true
  3. rpc-listen-all=true
Copy the Code

#Advanced Options
  1. disable-ipv6=true
  2. file-allocation=falloc
  3. max-overall-download-limit=0
  4. max-download-limit=0
  5. save-session=/etc/aria2/aria2.session
  6. save-session-interval=300
Copy the Code

Saveconfiguration and test the function
  1. aria2c--conf-path=/etc/aria2/aria2.conf  -D
Copy the Code

To seewhether aria2 is running
  1. ps–ef|grep aria2
Copy the Code

(3)Enable aria2boot as the system start
Edit/etc/rc.lcal,and insert the following contents before exit0.
  1. sudo aria2c--conf-path=/etc/aria2/aria2.conf –D
Copy the Code

The next time you start LeMaker Guitar, aria2 will automatically run
3.2 To build web server
(1)Install nginx
  1. sudoapt-get install nginx
Copy the Code

Create a new directory
  1. sudomkdir /aria2download/html
  2. sudo chmod  777  /aria2download/html
Copy the Code

(2) To configure the nginx
  1. sudonano /etc/nginx/sites-available/default
Copy the Code

find out sentence #listen 80; and delete the symbol#. Underneathchange the sentence root /usr/share/nginx/htmltoroot /aria2download/html
(3)Reload and restart the nginx
  1. sudo/etc/init.d/nginx reload
  2. sudo/etc/init.d/nginx restart
Copy the Code

(4)Install yaaw
Download the yaaw from
Afterdownload,extract the compressed fileandcopyall of the contents under thedirectory yaaw-master to the directory /aria2download/html.
Now we use Google Chrome or Firefox browse to open the web page address on our computer then you can see the page as follow.
Yes,we did it. Let’s try it right now.
4 Install the DLNA steaming mediaserver
DLNA is mainly oriented to media resources(such as video,music)to realize the network sharing.The setting steps as follows:
4.1 Install minidlna
  1. sudo apt-get install minidlna
Copy the Code

4.2 Configure the minidlna
Createthe dircreatory
  1. sudomkdir /aria2download/minidlna
  2. sudomkdir /aria2download/minidlna/dd
  3. sudomkdir /aria2download/minidlna/log
  4. sudochmod –r 777 /aria2download/minidlna
Copy the Code

  1. sudonano /etc/minidlna.conf
Copy the Code

Findout media_dir=/var/lib/minidlna andreplace it
  1. media_dir=/aria2download/download
Copy the Code

Find out #db_dir=/var/lib/minidlna andreplace it
  1. db_dir=/aria2download/minidlna/db
Copy the Code

Findout #log_dir=/var/logandreplace it
  1. log_dir=/aria2download/minidlna/log
Copy the Code

Lastfind out the default minidlna database and log files then delete it to avoidconfusion
  1. rm–r /var/lib/minidlna
  2. rm–r /var/log
Copy the Code
4.3 Restart minidna
  1. sudo/etc/init.d/minidlna restart
Copy the Code

To seewhether aria2 is running
  1. /etc/init.d/minidlnastatus
Copy the Code

Wehave successfully established a streaming media server.But we need toturn off the firewall or allow the Windows Media Player through the firewallbefore we use it. Now we can see the sharing streaming media files by theWindows Media Playerin the LAN.
Wealso can see it on our mobile phone via the streaming media player software.Here I use moliplayer.
NAShome server finally completed! We can put the server on a corner of homeworking for us, now.

Looks Great

Amazing tutorial! I have to test it!

A great topic, I really like the topics you share. Thank you for the offer. the impossible quiz

I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate. I just additional up your RSS feed to my MSN News Reader. Seeking forward to reading more from you later on!?  Classic Pacman

You have to log in before you can reply Login | Sign Up

Points Rules