How To: Install and Configure Shoutcast Radio

Shoutcast is a mp3 broadcasting/streaming media server software provided by NullSoft. One can setup a server on any system, GNU/Linux / Windows/ MacOS and can stream mp3 over the network, internet/intranet. I setup shoutcast on my system a long back and found it very useful. Here is a step by step how to on how you can setup shoutcast on a GNU/Linux system.

Shoutcast can be installed even if you don’t have root privileges. But in that case you can’t use port less than 1024 for broadcasting. Below, I’ll explain how to install it for a non-root user.

Shoutcast server depends on a tool shoutcast DNAS for audio input in Linux. So, here we go

Step 1

Download the latest version of shoutcast from here. Download the one for Linux (glibc).

Step 2

Let us assume we want to install shoutcast in a directory named ‘shoutcast’ in user’s home directory and we want to broadcast punjabi songs.

1
2
3
[saini@bordeaux shoutcast]# tar -xvzf sc_serv_1.9.8_Linux.tar.gz [Enter]
[saini@bordeaux shoutcast]# mkdir punjabi [Enter]
[saini@bordeaux shoutcast]# mv sc_serv.conf punjabi/sc_serv_punjabi.conf [Enter]

Step 3

Open sc_serv_punjabi.conf in your favorite editor and modify certain parameters as per you requirements. The essentials are below.

1
2
3
4
5
6
7
8
9
10
11
12
13
MaxUser=20
Password=yourPassword
PortBase=8300 #(Confirm that this port and the port PortBase+1 is not being used)
LogFile=none
RealTime=0
ScreenLog=0
ShowLastSongs=10
SrcIP=ANY
DestIP=ANY
Yport=80
NameLookups=0
AdminPassword=yourAdminPassword
TitleFormat=%s [IIIT Radio]

etc. My sc_serv.conf can be accessed here. That was all for installing the shoutcast server.

Now, the installation of DNAS tool is still pending. Here is a step by step procedure to install DNAS tool.

Step 1

Download the latest version of DNAS tool from here.

Step 2

1
2
3
4
[saini@bordeaux shoutcast]# tar -xvzf sc_trans_posix_040.tgz [Enter]
[saini@bordeaux shoutcast]# cd sc_trans_040/ [Enter]
[saini@bordeaux sc_trans_040]# mv sc_trans_linux ../ [Enter]
[saini@bordeaux sc_trans_040]# mv sc_trans.conf ../punjabi/sc_trans_punjabi.conf [Enter]

Step 3

Go to punjabi directory and open sc_trans_punjabi.conf in your favorite editor and make changes according to your needs. Here are some

1
2
3
4
5
6
7
8
9
PlaylistFile=/exactPathTo/punjabi.lst
ServerIP=
ServerPort=
 # 8300 in this case
Password=
 # yourPassword in this case
StreamTitle= %s
StreamURL=
Shuffle=1 # (1 for random songs)

etc. My sc_trans.conf can be accessed here.

Step 4

Generate a list of all the songs (mp3) you have and put it in punjabi.lst in punjabi directory.

[saini@bordeaux punjabi]# find /pathToPunjabiDir/ -type f -name "*.mp3" > punjabi.lst [Enter]

My dummy punjabi.lst can be accessed here.

The configuration part of shoutcast server with audio input is complete. Now we have to run the server so that we can listen to music.

Go to the shoutcast directory and run the sc_serv first and then run the sc_trans_linux. Here is way to do that.

1
2
[saini@bordeaux shoutcast]# ./sc_serv punjabi/sc_serv_punjabi.conf > /dev/null 2> /dev/null &
[saini@bordeaux shoutcast]# ./sc_trans_linux punjabi/sc_trans_punjabi.conf > /dev/null 2> /dev/null &

Now your system is a shoutcast server. Any client can use mplayer, vlc, amarok or any other multimedia player that support streaming media to listen to the music being played on your server.

1
2
[saini@bordeaux saini]# mplayer http://yourIp:port [Enter]
[saini@bordeaux saini]# mplayer http://localhost:8300 [Enter] # (in the above case).

If you want shoutcast to start every time your system boots. Put these lines in /etc/rc.local

1
2
/home/saini/shoutcast/sc_serv /home/saini/shoutcast/punjabi/sc_serv_punjabi.conf > /dev/null 2> /dev/null &
/home/saini/shoutcast/sc_trans_linux /home/saini/shoutcast/punjabi/sc_trans_punjabi.conf > /dev/null 2> /dev/null &

Shoutcast is fun and its more fun when everyone listens to what you are listening to 🙂

 

How To: Install WordPress on LAMP

Recently, I bought this domain name and shifted all my blogs here on saini.co.in . As I chose wordpress as the software to blog. So, just installed it and started using it right away. Installing wordpress is one of the most easiest things that you’ll ever do. Below is a step by step howto on installing wordpress and importing your current wordpress.com blog to your domain.

Step 1:

Download latest version of wordpress from here.

Step 2:

Go to the directory where you want to install it. Here I am taking gofedora.com as reference website where we want to install the wordpress and ~/htdocs/ as the web directory for gofedora.com . Modify above details in accordance with your needs.

If you downloaded .zip format then do this

[saini@bordeaux htdocs]# unzip wordpress-X.X.X.zip [Enter]

If you download .tar.gz format then do this

[saini@bordeaux htdocs]# tar -xvzf wordpress-X.X.X.zip [Enter]

Step 3:

[saini@bordeaux htdocs]# mv wordpress/* . [Enter]

If you visit http://gofedora.com now, you’ll get an error as shown in the image below …

Wordpress Error Without wp-config

Step 4:

Open the file wp-config-sample.php in your favorite text editor and edit the things shown in the image below.

Sample wp-config

Enter your database name, database username, database password and the table prefix for the wordpress database. e.g. one can use linux_ as table prefix. If you have the database on the same system, then there is no need to change the database host otherwise change it accordingly.

Step 5:

[saini@bordeaux htdocs]# mv wp-config-sample.php wp-config.php [Enter]

Step 6:

Go to http://gofedora.com/ and you’ll see a welcome page if you gave correct setting in wp-config.php . The page is like in the image below.

Wordpress Blog Config

Fill the settings properly. Anyway you can change them afterwards. Fill the blog name and email id and click Install WordPress.

Step 7:

You’ll see a web-page like in the image below, if everything goes fine. Copy the password on the page and paste at some temporary place and click login.

Wordpress Copy Password

Step 8:

You’ll be presented with a login page. Enter ‘admin’ as username and the password you copied from the previous page.

Wordpress Admin Login

Step 9:

Congratulations ! You have successfully installed wordpress and created the admin login. Go to Users -> Authors & Users and click Edit in the row with admin as author. Change the password on the next page as below ..

Wordpress Change Password

This is all you have to do to install wordpress. Below is how you import wordpress.com blog to your domain.

Step 1:

Login as admin on you wordpress.com blog and go to Manage -> Export and download the exported blog to your system as show in the image below.

Wordpress Export Blog

Step 2:

Create directory named ‘uploads’ in ~/htdocs/wp-content/ and change permissions to 777 so that wordpress can upload your blog there.

1
2
3
[saini@bordeaux htdocs]# cd wp-content [Enter]
[saini@bordeaux wp-content]# mkdir uploads [Enter]
[saini@bordeaux wp-content]# chmod 777 uploads [Enter]

Step 3:

Go to Manager -> Import section and click on ‘wordpress’ . Upload the .xml file that you download from your wordpress.com blog in step 1 on the page as shown in the image below ..

Wordpress Import Blog

Step 4:

If uploading goes successful, then all your posts will be imported from your wordpress.com blog and will be stored in the database as gofedora.com . Now it will ask you for the author of the new blog posts at gofedora.com as show below …

Choose New Author

Step 5:

Change the permission of uploads back to normal as show below

[saini@bordeaux wp-content]# chmod 744 uploads [Enter]

Everything is done. Now you blog has been shifted to your domain and you can go on with the new blog. But keep in the mind the the images you used in wordpress.com blog posts are not stored in your local database, they are still linked back to your wordpress.com blog images. So, don’t just go and delete your wordpress.com blog. That would be fatal.

The steps for installing wordpress on a windows system are the same, but you have to use some notepads and whatever to edit files 🙂

Enjoy blogging at your domain. Hope the above howto helps.

 

How To: Install Javascript Plugin in Eclipse

Today, I installed Eclipse on my Fedora 7 desktop. Everything is fine, but the default Eclipse does not have a plugin for JavaScript. So , I searched a lot on Google and read a lot of reviews about some JavaScript plugins available for Eclipse. And I finally reached the JSEclipse plugin by Adobe Labs. I had a good experience with it. Its great to work with and if you are looking for a javascript plugin for eclipse, just don’t search any more and install it. JSEclipse can be downloaded from here after registering with Adobe. Following are the simple steps to install the JSEclipse.

Launch Eclipse and do as suggested in images.

Step 1 :

Follow this image :

Help Software Updates Find And Install

Step 2:

Select “Search new features to install” and click next.

Search New Features To Install

Step 3:

Click “New archived site” and select the package or zip file you just downloaded from the above link and click open.

Choose New Archived Site

Step 4: Click OK.

Select Local Zip File And Click Open Then Click OK

Step 5: Check the package if not checked and click next.

Click Finish

Step 6: Check the features you want to install and click next.

Select Features To Install And Click Next

Step 7: Accept Terms and conditions and click next.

Accept Terms And Conditions

Step 8: Click finish and when it ask to restart eclipse just click yes.

Click Finish

Step 9: Voila !! JavaScript plugin is installed now. Have fun with it.

Eclipse With Javascript Plugin

PS: A lot of howtos are pending. Will Try to finish them asap 😀

 

How To: Install Eclipse in Fedora 7

I have decided to stick with Fedora 7 due to the bad experience with Fedora 8 last night and also the difficulties in moving the servers to new os that I am running on Fedora 7. As I wanted to work with Padma in my spare time, so need a good IDE that can handle project in a nice way and can help me to import the cvs from repos online. So, is there any choice I have. There is one and only one – The Eclipse. Some people call it – programming paradise. Some may disagree to that and some other may say that Vim is best to program. I also use Vim quite often and in fact 90% of the time I do so. But using Vim looks confusing when the size of the project is beyond certain extent.

Anyway, here I am going to discuss how to install Eclipse in Fedora 7 because its not there by default. There are two approaches. One is extremely simple and other is extremely difficult.

Approach 1

Use yum do install eclipse. Just issue ‘yum install eclipse-*’ and it’ll be done automatically. But this method takes a very long time as yum will sequentially download the packages and dependencies and its very slow.

Approach 2

If I have a good bandwidth, then I’ll download all the packages and resolve the dependencies myself. But resolving dependencies will be frustrating enough that anyone will switch back to slow yum. But due to certain reasons which I suspect to be memory leaks by Firefox and other apps, my system was damn slow and yum could not do anything even after 10 minutes. It was not even able to download the package list.

So, I decided to download all the packages and install them. I download all the eclipse packages and their dependencies manually and installed it successfully. Here is the list of packages and dependencies so that you need not do rpm -ivh a 100 times 🙂 All these dependencies are available on rpmfind.net and packages can be fetched from any fedora mirror. These are tested on Fedora 7.

Packages

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
eclipse-cdt-3.1.2-8.fc7.i386.rpm
eclipse-cdt-sdk-3.1.2-8.fc7.i386.rpm
eclipse-checkstyle-4.0.1-6.fc7.i386.rpm
eclipse-ecj-3.2.2-15.fc7.i386.rpm
eclipse-jdt-3.2.2-15.fc7.i386.rpm
eclipse-jdt-sdk-3.2.2-15.fc7.i386.rpm
eclipse-pde-3.2.2-15.fc7.i386.rpm
eclipse-pde-runtime-3.2.2-15.fc7.i386.rpm
eclipse-pde-sdk-3.2.2-15.fc7.i386.rpm
eclipse-platform-3.2.2-15.fc7.i386.rpm
eclipse-platform-sdk-3.2.2-15.fc7.i386.rpm
eclipse-rcp-3.2.2-15.fc7.i386.rpm
eclipse-rcp-sdk-3.2.2-15.fc7.i386.rpm
eclipse-sdk-3.2.2-15.fc7.i386.rpm
eclipse-subclipse-1.2.4-2.fc7.i386.rpm
eclipse-subclipse-book-1.2.4-2.fc7.i386.rpm

Dependencies

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ant-1.6.5-4jpp.2.fc7.i386.rpm
ant-antlr-1.6.5-4jpp.2.fc7.i386.rpm
ant-apache-bcel-1.6.5-4jpp.2.fc7.i386.rpm
ant-apache-log4j-1.6.5-4jpp.2.fc7.i386.rpm
ant-apache-oro-1.6.5-4jpp.2.fc7.i386.rpm
ant-apache-regexp-1.6.5-4jpp.2.fc7.i386.rpm
ant-apache-resolver-1.6.5-4jpp.2.fc7.i386.rpm
ant-commons-logging-1.6.5-4jpp.2.fc7.i386.rpm
ant-javadoc-1.6.5-4jpp.2.fc7.i386.rpm
ant-javamail-1.6.5-4jpp.2.fc7.i386.rpm
ant-jdepend-1.6.5-4jpp.2.fc7.i386.rpm
ant-jsch-1.6.5-4jpp.2.fc7.i386.rpm
ant-junit-1.6.5-4jpp.2.fc7.i386.rpm
antlr-2.7.7-1jpp.2.i386.rpm
antlr-javadoc-2.7.7-1jpp.2.i386.rpm
ant-nodeps-1.6.5-4jpp.2.fc7.i386.rpm
ant-swing-1.6.5-4jpp.2.fc7.i386.rpm
ant-trax-1.6.5-4jpp.2.fc7.i386.rpm
avalon-logkit-1.2-4jpp.5.fc7.i386.rpm
checkstyle-4.1-4jpp.1.fc7.noarch.rpm
checkstyle-optional-4.1-4jpp.1.fc7.noarch.rpm
ganymed-ssh2-210-5.fc7.i386.rpm
jakarta-commons-beanutils-javadoc-1.7.0-5jpp.1.i386.rpm
jakarta-commons-cli-1.0-6jpp_10.fc6.i386.rpm
jakarta-commons-dbcp-1.2.1-10jpp.1.fc7.i386.rpm
jakarta-commons-lang-2.1-6jpp.1.fc7.i386.rpm
jakarta-commons-pool-1.3-9jpp.2.fc7.1.i386.rpm
java-1.5.0-gcj-javadoc-1.5.0.0-14.fc7.i386.rpm
jdepend-2.6-6jpp.1.i386.rpm
jdom-1.0-4jpp.1.i386.rpm
jsch-0.1.28-1jpp.6.i386.rpm
junit-3.8.2-3jpp.1.fc7.i386.rpm
jzlib-1.0.7-4jpp.1.i386.rpm
libswt3-gtk2-3.2.2-15.fc7.i386.rpm
lucene-1.4.3-1jpp.18.i386.rpm
lucene-devel-1.4.3-1jpp.18.i386.rpm
subversion-1.4.4-1.fc7.i386.rpm
subversion-javahl-1.4.4-1.fc7.i386.rpm
svnkit-1.1.4-2.fc7.i386.rpm
velocity-1.4-6jpp.1.i386.rpm
werken.xpath-0.9.4-0.beta.8jpp.noarch.rpm
xml-commons-apis-javadoc-1.3.03-0jpp.1.fc7.i386.rpm

So, be sure to fetch the dependencies first. Hope that helps.

 

How To: Configure Secure FTP Server (VSFTPD)

This post is totally dedicated to vsftpd configuration with uploads enabled. vsftpd stands for Very Secure FTP Daemon. It is shipped with almost all the latest Red Hat based OS. vsftpd for rpm based Linux distros can be downloaded from here. Also, one can install vsftpd by issuing ‘yum install vsftpd’ or ‘apt-get install vsftpd’ command. After installing vsftpd, you just need to start the vsftpd service.

[root@bordeaux saini]$ service vsftpd start [Enter]

And you are done. Your computer is now a FTP server. You can browse your ftp server by pointing your favourite browser to ftp://localhost/ or ftp://127.0.0.1/ or ftp://<IP_ADDRESS_OF_YOUR_MACHINE> .

If you see access denied or some error related to access. Issue ‘iptables –flush’ and ‘setenforce 0’ commands.

By default the files and directories in /var/ftp/ directory will be shown at ftp://localhost/ . Now, there are two ways to share your files on ftp.

1. Copy/move files that you want to share to /var/ftp/ directory.

2. Mount directories you want to share to /var/ftp/SharedDirName. Suppose you want to share /home/saini/Movies/ folder on your ftp, then follow the following steps:

Step 1

Login as root.

1
2
[saini@bordeaux saini]$ su [Enter]
Enter Password for root.

Step 2

Go to /var/ftp/ and create the directory that you want to share.

1
2
[root@bordeaux saini]$ cd /var/ftp/ [Enter]
[root@bordeaux ftp]$ mkdir SharedMovies [Enter]

Step 3

Bind the original directory to SharedMovies.

[root@bordeaux ftp]$ mount --bind /home/saini/Movies/ /var/ftp/SharedMovies/ [Enter]

If you browse your ftp now, you’ll see SharedMovies folder as well. You can remove default pub directory if you don’t like it.

The current ftp server will be a very basic one and will allow only downloads. Below we will see how to configure it so that others are allowed to upload files/directories to your server.

Step 1

Create a directory say ‘Upload’.

[root@bordeaux saini]$ mkdir Upload [Enter]

Note that this Upload directory can be anywhere either in your home directory or in /var/ftp/ or even on some other partitions.

Step 2

Change the ownership of Upload to ftp and change the permissions to 777.

1
2
[root@bordeaux saini]$ chown ftp:ftp Upload [Enter]
[root@bordeaux saini]$ chmod 777 Upload [Enter]

Step 3

If you created Upload at any place other than /var/ftp/ , then bind it to a dir in /var/ftp/ .

1
2
[root@bordeaux saini]$ mkdir /var/ftp/Uploads [Enter]
[root@bordeaux saini]$ mount --bind /home/saini/Upload/ /var/ftp/Uploads/ [Enter]

Step 4

Configure vsftpd.conf . The default configuration files for vsftpd lives in /etc/vsftpd/ . vsftpd.conf is configuration file for vsftpd.
Open /etc/vsftpd/vsftpd.conf in any editor and add/uncomment the following lines :

Lines to be added or uncomments in /etc/vsftpd/vsftpd.conf

1
2
3
4
5
6
7
8
9
10
11
anonymous_enable=YES
write_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
dirmessage_enable=YES
dirlist_enable=YES
no_anon_password=YES
file_open_mode=0777
guest_enable=YES

Save vsftpd.conf file and restart the vsftpd service with the command ‘service vsftpd restart’. Now anyone can upload files to your ftp server, but only to Upload folder.

There are certain more configurations which are related to restricting bandwidth, upload/download speed, connections etc.

1
2
3
4
max_per_ip=2 # Max no. of allowed connections per IP Address.
max_clients=3 # Max no. of different IP Addressed which are allowed to connect.
anon_max_rate=1097152 # Max bytes/sec a user can upload/download to/from your ftp server.
banner_file=/etc/vsftpd/ftp_banner # The file containing the welcome message to be displayed to the clients.

For more configuration options, refer man pages for vsftpd.conf and vsftpd.

Note :

  • Whenever you restart your computer, you have to bind the directories everytime, so that they are shown on the ftp server. To skip binding every time, write everything (all commands for binding) in a mount.sh file and run it whenever you restart your computer.
  • You can view my vsftpd.conf file here.
  • Sometime, uploaded files doesn’t have 777 permissions. You can run this shell script in background forever.

PS0 : Absence of compat-libstdc++-33(libstdc++.so.5) is breaking a large no. of applications in Fedora 7. Here’s a solution anyway.