Thread: HOWTO: Remote Media Catalog
this howto explain how access system remotely several different reasons. including not limited to.
- filesharing
remote administration
webhosting
media streaming
first step setup ssh server.
before doing make sure have strong password, users sudoer permissions.
next want forward port 22 router or modem.code:sudo apt-get install ssh
can't explain howto this, should able figure out. want internal ip address first.
replacing eth0 network card use access web. note don't recommend setting computer access's web wireless server.code:ifconfig eth0|grep inet|grep -v inet6
write down address. want make sure static address, beyound guide. can find information google or in forums.
address goto router or modem, more replacing last digit of ip address one
example if ip address is
192.168.100.2
router 192.168.100.1
or if address is
10.0.1.23 router 10.0.1.1
192.168.1.12 router 192.168.1.1
in table want forward tcp traffic on port 22 ip address(some router might show drop menu host name, in case select hostname).
want forward port 80 webserver.
next want setup database.
write down password createdcode:sudo apt-get install mysql-server
restart mysql server
now install webservercode:sudo /etc/init.d/mysql restart
restart apachecode:sudo apt-get install apache2 php5 libapache2-mod-php5
test webserver workscode:sudo /etc/init.d/apache2 restart
put in codecode:sudo vi /var/www/index.php
save , in browser gotophp code:<?php
phpinfo()
?>
http://localhost/index.php
should see php info page.
goto http://www.dyndns.com/
setup account.
(this dealing fact home internet connection have dynamic ip changes on regular interval based on isp's dhcp server)
once account setup want
add new hostname
defaults work, pick hostname , , select
use auto detected ip address ###.###.###.###
add cart check out.
free, if ask money not doing right!!!
defeats whole purpose if pay anything.
once done.
goto support>dns tools>update client configurator
select check box next hostname
, dot box next
inadyn
click generate
copy , save favorite text edit , set aside. call inadyn.conf save on desktop
need install inadyn
your want file created , saved desktop inadyn.confcode:sudo apt-get install inadyn
now edit filecode:sudo cp ~/desktop/inadyn.conf /etc/inadyn.conf
replace ##your password## passwordcode:vi /etc/inadyn.conf
security purposes lets make sure no 1 root can read file.
now default, don't way inadyn handles self , find doesn't update readily , striving higher uptime when remote key.code:sudo chmod g-r /etc/inadyn.conf sudo chmod o-r /etc/inadyn.conf
write 2 scripts. 1 run command @ boot, , 1 kill rerun command every 2 hours(every hour , black listed)
insert thiscode:sudo vi /etc/init.d/inadyn
save scriptcode:#!/bin/bash #check see if running , add pid variable $is_it_running is_it_runing=`ps -a|grep inadyn|grep -v grep|awk '{print$1}'` echo $is_it_runing case $1 in start) #if not running start if [ $is_it_runing ]; echo running else echo starting /usr/sbin/inadyn & fi ;; stop) if [ $is_it_runing ]; kill $is_it_runing else echo not running fi ;; restart) if [ $is_it_runing ]; echo stopping kill $is_it_runing fi echo starting /usr/sbin/inadyn & ;; force-stop) killall inadyn || true sleep 2 killall -9 inadyn || true ;; *) echo "usage: /etc/init.d/inadyn {start|stop|restart|force-stop}" exit 1 ;; esac
give executable permissions
add startup scriptcode:sudo chmod +x /etc/init.d/inadyn
now write script run every 2 hours. check if running, stop , restart it.code:sudo update-rc.d inadyn defaults
add code itcode:sudo vi /usr/local/bin/inadyn.sh
make executablecode:#!/bin/bash #check see if running , add pid variable $is_it_running #replace google.com hostname dyndns.org ######################## ddnshostname=google.com ######################## #replace location of log file ######################## ddnslogfile=/var/log/ddnds.log ######################## is_it_runing=`ps -a|grep inadyn|grep -v grep|grep -v .sh|awk '{print$1}'` if [ $is_it_runing ]; kill $is_it_runing fi /usr/sbin/inadyn & #determine size of log file ddnssizolf=`wc -l $ddnslogfile|awk '{print$1}'` #maximum size of log file maxdnslsize=100 if [ $ddnssizolf > $maxdnslsize ]; mv $ddnslogfile $ddnslogfile.0 fi #appends time stamp followed ip address of hostname log file ########################## date >> $ddnslogfile dig ddnshostname|grep in|awk '{print$5}' >> $ddnslogfile #########################
now add croncode:sudo chmod +x /usr/local/bin/inadyn.sh
add linecode:sudo vi /etc/crontab
change 15 between 1 , 60 not hitting dyndns @ same time , update every 2 hours on minute if 12 2:12, 4:12 etc...code:15 */2 * * * root /usr/local/bin/inadyn.sh
save file , restart cron
now should go hostname use access machine remotely.code:sudo /etc/init.d/cron restart
@ point have ssh, lamp(linux apache, mysql, , php) , hostname setup.
can access machine anywhere. make sure server has port 22 open if using firewall, default ubuntu not have port blocked should fine.
note can file transfers ssh though client such filezilla, on quick connect put port 22 or when setting host select secure file transfer ssh 22.
media. want consolidate media files if possible, software handle won't go that.
point of howto, lets assume music located in 2 location.
linux collection here
/home/yourusername/music
old files windows here
/media/disk/music
want download ampache
first prepare system
if asked choose "apache2"code:sudo apt-get install eyed3 gettext intltool-debian javascript-common libgd2-xpm libjs-prototype libmail-sendmail-perl libmcrypt4 libsys-hostname-long-perl libt1-5 php5-cli php5-gd php5-mcrypt php5-mysql phpmyadmin po-debconf python-eyed3 wwwconfig-common
http://ampache.org/download.php
save it.
default firefox saves desktop , i'll assume downloaded 3.5.1 change if applicable
move archive /var/www folder
extract filecode:sudo mv ~/desktop/stable.tar.gz /var/www
create more userfriendly directorycode:sudo tar -zxvf stable.tar.gz
now in browser goto herecode:sudo mv ampache-3.5/ ampache
sudo mv ampache-3.5/ ampache
http://localhost/ampache/install.php
choose start configuration
remember database information earlier
follow directions
on step 2 when click write config , download box pop click save
move config location
1359code:sudo mv ~/ampache.cfg.php /var/www/ampache/config/
check config, should 2 ok's
continue step 3
create ampache account
go admin section>add catalog
call first catalog linux
path /home/yourusername/music
add catalog
add catalog windows
path /media/disk/music
should have setup. note won't able access remote hostname local area network. theirs easy fix this. add line /etc/hosts file
at bottom before #the following lines..... addcode:sudo vi /etc/hosts
so if host name ubuntu.homelinux.com you'd add end line.code:127.0.0.1 yourhostman.whatever.com
when type in browser http://yourhostname.whatever.com/ampache take site.
can go step further , add virtualhost apache2 configuration defaults yourhostname /var/www/ampache
questions or comments post them below
test working, go through proxy , try reach website though hostname, ampache won't play music, should able see it, if works work when try access out side of lan long net connection computer running , ip has changed in last 2 hours able log in , stream music anywhere.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Networking & Wireless [ubuntu] HOWTO: Remote Media Catalog
Ubuntu
Comments
Post a Comment