Skip to main content

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.
code:
sudo apt-get install ssh
next want forward port 22 router or modem.
can't explain howto this, should able figure out. want internal ip address first.
code:
ifconfig eth0|grep inet|grep -v inet6
replacing eth0 network card use access web. note don't recommend setting computer access's web wireless server.
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.
code:
sudo apt-get install mysql-server
write down password created
restart mysql server
code:
sudo /etc/init.d/mysql restart
now install webserver
code:
sudo apt-get install apache2 php5 libapache2-mod-php5
restart apache
code:
sudo /etc/init.d/apache2 restart
test webserver works
code:
sudo vi /var/www/index.php
put in code
php code:
<?php
phpinfo
()
?>
save , in browser goto
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
code:
sudo apt-get install inadyn
your want file created , saved desktop inadyn.conf
code:
sudo cp ~/desktop/inadyn.conf /etc/inadyn.conf
now edit file
code:
vi /etc/inadyn.conf
replace ##your password## password
security purposes lets make sure no 1 root can read file.
code:
sudo chmod g-r /etc/inadyn.conf sudo chmod o-r /etc/inadyn.conf
now default, don't way inadyn handles self , find doesn't update readily , striving higher uptime when remote key.
write 2 scripts. 1 run command @ boot, , 1 kill rerun command every 2 hours(every hour , black listed)
code:
sudo vi /etc/init.d/inadyn
insert this
code:
#!/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
save script
give executable permissions
code:
sudo chmod +x /etc/init.d/inadyn
add startup script
code:
sudo update-rc.d inadyn defaults
now write script run every 2 hours. check if running, stop , restart it.
code:
sudo vi /usr/local/bin/inadyn.sh
add code it
code:
#!/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 #########################
make executable
code:
sudo chmod +x /usr/local/bin/inadyn.sh
now add cron
code:
sudo vi /etc/crontab
add line
code:
15 */2    * * *   root    /usr/local/bin/inadyn.sh
change 15 between 1 , 60 not hitting dyndns @ same time , update every 2 hours on minute if 12 2:12, 4:12 etc...
save file , restart cron
code:
sudo /etc/init.d/cron restart
now should go hostname use access machine remotely.
@ 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
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
if asked choose "apache2"
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
code:
sudo mv ~/desktop/stable.tar.gz /var/www
extract file
code:
sudo tar -zxvf stable.tar.gz
create more userfriendly directory
code:
sudo mv ampache-3.5/ ampache
now in browser goto here
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
code:
sudo mv ~/ampache.cfg.php /var/www/ampache/config/
1359
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
code:
sudo vi /etc/hosts
at bottom before #the following lines..... add
code:
127.0.0.1 yourhostman.whatever.com
so if host name ubuntu.homelinux.com you'd add end line.
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

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums