Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, 21 August 2014

How to broadcast Linux hostname to Windows Network (Based on CentOS 6 / 7)

Do you have an experience, that Ubuntu able to broadcast its hostname to Windows network where other Linux OS have issues on it?

You googled for remedy.
You edited ifcfg-xxx, dhclient-xxx.conf, /etc/hostname.
You tried nsupdate.

But, nothing worked and frustrates you.
Changing hostname in Ubuntu alone affects immediately.
You start to think that you should have used Ubuntu...

Well, here is my solving method based on both CentOS 6 / 7.
(Do it with your own responsibility)

After the OS installation with "Web Server" package.

You install SAMBA.
# yum install samba

Next, you rename your hostname.
# hostname my-centos

Start the SAMBA NMB Daemon.
# service nmb start

There, you should be able to ping "my-centos" from Windows.
If you still unable to get them, it might be SELinux / iptables issue.
It's not recommended but you can disable it.

# setenforce 0
# iptables -F

There. it should be working nicely right now.
Have a nice day =)

Monday, 28 May 2012

How to setup FFMPEG with major codecs in

Video transcoding is 1 of my many hobbies.
When it comes to video encoder, FFMPEG is absolutely the best solution.

Follow the steps below to install it today!

Based ON Fresh Installed CentOS 5.x

[Update Current Software and Libraries]
# yum update

[Install RPMForge Repository][Replace * with i386 or x86_64]
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.*.rpm
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
# rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

[Install Tools and Libraries for Compiling]
# yum install gcc gcc-c++ glib glib-devel libtool automake autoconf git subversion

[Add Library Path to ld.so.conf]
# vi /etc/ld.so.conf
** add /usr/local/lib

[LAME MP3]
# wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
# tar xzvf lame-3.99.5.tar.gz
# cd lame-3.99.5
# ./configure
# make
# make install

$ cd ..

[LIBA52]
# wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
# tar xzvf a52dec-0.7.4.tar.gz
# cd a52dec-0.7.4

-- 32 Bit --
# ./configure
-- 64 Bit --
# ./configure CFLAGS="-fPIC"

# make
# make install

$ cd ..

[FAAC]
# wget http://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
# tar xzvf faac-1.28.tar.gz
# cd faac-1.28
# sh bootstrap
# ./configure
# make
# make install

[NASM & YASM]
# wget http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/nasm-2.12.01.tar.gz
# tar xzvf nasm-2.12.01.tar.gz
# cd nasm-2.12.01
# ./configure
# make
# make install

$ cd ..

# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
# tar xzvf yasm-1.3.0.tar.gz
# cd yasm-1.3.0
# ./configure
# make
# make install

$ cd ..

[X264]
# git clone git://git.videolan.org/x264.git x264-git
# cd x264-git
-- 32 Bit --
# ./configure --enable-shared --extra-cflags=-fPIC
-- 64 Bit --
# ./configure --enable-shared
# make
# make install

$ cd ..

[XVID]
# wget http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
# tar xzvf xvidcore-1.3.4.tar.gz
# cd xvidcore/build/generic
# ./configure
# make
# make install

$ cd ../../..

[WIN32 CODECS]
# wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2
# tar xjvf all-20110131.tar.bz2
# mv all-20110131 /usr/local/lib/all-20110131
# mv /usr/local/lib/all-20110131 /usr/local/lib/win32

[Ogg Theora & Ogg Vorbis]
# wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
# tar xzvf libogg-1.3.2.tar.gz
# cd libogg-1.3.2
# ./configure
# make
# make install

$ cd ..

# wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
# tar xzvf libvorbis-1.3.5.tar.gz
# cd libvorbis-1.3.5
# ./configure
# make
# make install

$ cd ..

# wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
# tar xjvf libtheora-1.1.1.tar.bz2
# cd libtheora-1.1.1
# ./configure
# make
# make install

$ cd ..

[FLAC]
# wget http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz
# tar xJvf flac-1.3.1.tar.xz
# cd flac-1.3.1
# ./configure
# make
# make install

$ cd ..

[OPUS]
# wget http://downloads.xiph.org/releases/opus/opus-1.1.2.tar.gz
# tar xzvf opus-1.1.2.tar.gz
# cd opus-1.1.2
# ./configure
# make
# make install

$ cd ..

[VP8/VP9/VPX]
# git clone http://git.chromium.org/webm/libvpx.git vpx-git
# git clone https://chromium.googlesource.com/webm/libvpx vpx-git
# cd vpx-git
-- 32 Bit --
# ./configure --enable-vp8 --enable-vp9 --enable-vp10 --enable-shared --extra-cflags=-fPIC
-- 64 Bit --
# ./configure --enable-vp8 --enable-vp9 --enable-vp10 --enable-shared
# make
# make install

$ cd ..

[HEVC / X265]
# yum install hg cmake
# hg clone https://bitbucket.org/multicoreware/x265 x265-hg
# cd x265-hg/build/linux
# ./make-Makefiles.bash
# make
# make install

$ cd ..

[FFMPEG]
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig        <-- for HEVC
# git clone git://git.videolan.org/ffmpeg.git ffmpeg-git
# cd ffmpeg-git

-- 32 Bit --
# ./configure --enable-shared --enable-gpl --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libx264 --enable-libx265 --enable-memalign-hack --enable-static --enable-nonfree --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-version3
-- 64 Bit --
# ./configure --enable-shared --enable-gpl --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libx264 --enable-libx265 --enable-memalign-hack --enable-static --enable-nonfree --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-version3 --extra-cflags=-fPIC

# make
# make install

And you're done.
Have a nice day :)


!REMEMBER!
FFMPEG are not for commercial use.

Thursday, 5 April 2012

How to setup postfix + dovecot mail server based on CentOS 6.2

This have been taking me hours to configure it.

1. Stop the sendmail service and remove it
> service sendmail stop
> yum remove sendmail

2. Install Postfix and Dovecot
> yum install postfix dovecot

3. Edit you hosts file and Add 'mail.yourdomain.com' and 'mail' to 127.0.0.1
> vi /etc/hosts

4. Edit the programs configuration. Mostly about user, servername, etc...
(Will edit later for details)
> vi /etc/postfix/main.cf
> vi /etc/dovecot/dovecot.conf
> vi /etc/aliases

4A. postfix/main.cf sample, configs that added.
myhostname = mail.yourdomain.com
mydomain = yourdomain.com
myorigin = $mydomain
inet_interfaces = all 
inet_protocols = ipv4 # required for CentOS 7 ~ 
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydestination = $myhostname, $mydomain
mynetworks = 192.168.0.0/24, 127.0.0.0/8
#relay_domains =
home_mailbox = Maildir/
smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination
#relayhost = your-hosting-site-mail-relay.yourhostingsite.com
FIGURE 4B. dovecot.conf sample, configs that added.
protocols = imap pop3
mail_location = maildir:~/Maildir
pop3_uidl_format = %08Xu%08Xv 
FIGURE 4C. /etc/aliases sample
# Person who should get root's mail
root:           kiddokenshin

5. Switch your MTA configuration and make sure is SMTP
> alternatives --config mta

6. Add mail user account (without SSH login)
> useradd -s /sbin/nologin youruser
> passwd youruser
> echo "youruserpasswd" | saslpasswd2 -p -u yourdomain.com -c youruser
> sasldblistusers2
> chgrp postfix /etc/sasldb2

7. Start your mail server
> service dovecot start
> service postfix start

8. Check your smtp port availability
> telnet localhost 25

Remember to add MX record and CNAME record on your domain manager. Most probably your mail server is working right now.

!! CAUTION !!
- If you cant send your mail out, most probably its the firewall's fault.
- Some rental server(or hosting site) required you to relay to their mail server to send mail.

If you like to use web browser to view and reply mail,
follow the optional instruction below to install the web based mailer, squirrelmail.

Installing squirrelmail (Optional)
A. Install EPEL Repository
> wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
> rpm -i epel-release-6-5.noarch.rpm

B. Install and Config SquirrelMail
(configure your squirrelmail, such as server name, smtp domain etc...)
> yum install squirrelmail
> /usr/share/squirrelmail/config/conf.pl

C. Edit httpd.conf and Restart httpd (assuming you have httpd)
> vi /etc/httpd/conf/httpd.conf
> service httpd restart

SAMPLE of httpd.conf
Alias /squirrelmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
    Options Indexes FollowSymLinks
    RewriteEngine On
    AllowOverride All
    DirectoryIndex index.php
    Order allow,deny
    Allow from all
</Directory>

Log into http://yourdomain.com/squirrelmail to access it.

Monday, 2 April 2012

How to setup SVN server with httpd based on centos 6.2

Installing SVN server is quite a headache.
This is my installation steps based on centos 6.2

1. Install Httpd and Subversion
> yum install httpd mod_dav_svn subversion

2. Edit your httpd.conf (at least change your server name)
> vi /etc/httpd/conf/httpd.conf

3. Edit http's subversion.conf (path to svn repos, set auth type and password path)
> vi /etc/httpd/conf.d/subversion.conf

It should be something like this.
<Location /repos>
   DAV svn
   SVNParentPath /var/www/svn/repos
#
#   # Limit write permission to list of valid users.
#   <LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
### You can comment the lines here if you do not need auth
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /etc/svn-auth-conf
#      AuthUserFile /path/to/passwdfile
      Require valid-user
#   </LimitExcept>
</Location>

4. Create user for svn (if you are using auth to commit / check out)
> htpasswd -cm /etc/svn-auth-conf yoursvnuser

5. Create svn a repo
> mkdir -p /var/www/svn
> svnadmin create /var/www/svn/repos
> chown -R apache.apache /var/www/svn/repos

6. Local commit to repo
> svn import /tmp/somefolder file:////var/www/svn/repos -m "Initial commit"

7. Start your httpd
> service httpd start

8. Try checking out from the newly created repo
> svn co http://yourdomain/repos

There, a workable new svn server.