Installing Shoutcast on CentOs – shoutcast version 1 and 2

And now for something completly different, since it isn’t all about work hard, we need to shoutcastplay hard too. I was asked to build a shoutcast server on a linux centOs 6.6 server.

 

It’s not that hard to set up a shoutcast stream:

Fire up your linux server and add a new shoutcast user:

now sign in using this new account

create a new directory

and go there

Now I am gonna dowload shoutcast, im using 64x but you can find more installs here:

http://mirror.lchost.net/download.nullsoft.com/shoutcast/tools/

Let’s open up the packages

If you already downloaded a shoutcast versiom locally (f.e. the outdated, but populair shoutcast version 1.9.8), you can upload the zipped .tar.gz folder to your ftp and skip wget part and just tar from the location on your server.

Just remember, shoutcast v1 is 32bit and your server probably is 64, in this case, update your library with 32bit support. For more info on this subject: 64bit bad elf interpreter

Next we are gonna edit the config files in nano.

If nano isnt installed yet, you must install this first:

you need to configure these config files to your settings.

I will highlight the most important changes

sc_serv_basic.conf:

logfile=logs/sc_serv.log
w3clog=logs/sc_w3c.log
banfile=control/sc_serv.ban
ripfile=control/sc_serv.rip
password=chaneg this
adminpassword=change this
streamid=1
streampath=http://myIP or dns:80/

and sc_trans_basic.conf

streamtitle=My first Shoutcast Server
streamurl=http://www.myurl.com/
genre=Misc
inheritconfig=sc_serv.conf
logfile=sc_trans.log
uvoxradiometadata=1
uvoxnewmetadata=0
playlistfile=playlist.lst
shuffle=0

also add:

streamauthhash= you can leave this open now, w’ll get back to it later!

serverport=8555
serverip=localhost
encoder=mp3
mp3quality=1
bitrate=192000

we need to restart the server

now go to your browser and type in your IP and port number and you will see your shoutcast server up ad running.

You can use the stream addres to bring up your performance,

you’ll see ity streams only local , you need to add one more important step

last but important step to take, you added the streamauthhash, you need to get an authentication hash, you can get one using this link from your shoutcast admin:

http://yourIP:your port/index.html?sid=0

Now restart the shoutcast server and stream your podcast or music show

 

Beginning Node.js – local authentication with Passport-Local Mongoose – part 6

Disclaimer: This is a series about me, creating a web application in Node.js. The completed example is available here.

I have a deep respect for all those developers out there that write fantastic modules I can use in my projects. One little gem is passport-local-mongoose. I’ve written about it before but as you see I’m doing it again.

What is passport-local-mongoose?

You can plug-in passport-local-mongoose into your Mongoose Userschema. This decorates the User object with a set of methods. E.g.

  • authenticate
  • register
  • setPassword
  • serialize
  • deserialize

It also hashes the passwords. This saves a lot of work.

What we should work on

  • Users should be able to register
  • Users should be able to authenticate
  • Users should be able to change their password
  • Users should be able to change their e-mail address
  • There should be a ‘forgot password’ procedure
  • Users should be able to delete their accounts

This article covers only ‘register’ and ‘authenticate’. You can go ahead and clone the restaurant github repo for a full example.

To add local authentication to your app you’ll need to run:

When we’re done, this should be the file structure of the app:
.
├── app
│   ├── controller.food.js
│   ├── controller.user.js
│   ├── model.food.js
│   ├── model.user.js
│   ├── routes.food.js
│   └── routes.user.js
├── main.js
├── node_modules
│   ├── body-parser
│   ├── cookie-parser
│   ├── express
│   ├── express-session
│   ├── mongoose
│   ├── passport
│   ├── passport-local
│   └── passport-local-mongoose
├── package.json
└── public
├── index.html
└── index.html~

Create the User model

This is the minimum. By plugging in passport-local-mongoose into your user model you’ll get a username and a password property for free. And a whole lot of methods nonetheless, as we will see later.

Create a file named model.user.js and put it in the app folder:

Of course, you may add your own properties to the model:

Now let’s hook up Passport in our app.

Controller

Let’s create a user controller which contains the register, the login and the getLogin functions (to check if a user has logged in).
Create a file named controller.user.js and put it in the app folder:

What happens?
1. User.authenticate and User.register:
The User.authenticate and User.register are functions we get from passport-local-mongoose. I just took this code as an example.

2. Check if a user is logged in with ‘if(req.user)’
If a user is logged in, the req.user property is populated with the user object.
So if it exists, the user is logged in.

Routes

Add this file to main.js, like so:

This will be your completed main.js:

Let’s try this

Install Postman or another REST API test tool.

  • Don’t forget to configure the headers: Content-Type application/json

First, let’s register a user (click POST):

Postman_passport

Second, let’s login:

Selection_012

Check the login status:

Selection_015

The end of this series

This is where this series end. I hope anyone will enjoy this and at least learns something from my struggles. I know I did!
Your feedback is more than welcome by the way.