ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

617 items|« First « Prev 50 51 (52/62) 53 54 Next » Last »|
โดย Little Bear on 7 มิ.ย. 52 12:50

เพิ่งรู้ว่า Hosting Control Panel นั้นมีมากมายมหาศาลตอนที่เริ่มมี server เป็นของตนเอง ทำให้ต้องตัดสินใจเลือกว่าจะใช้ตัวไหนดี ซึ่งต้องลองดูหลาย ๆ ตัว ปวดหัวมาก ๆๆๆๆๆๆๆๆๆๆ

แบบที่ต้องจ่ายตังส์

แบบฟรี

เพิ่มเติมนิดหน่อยเป็นความรู้

โดย Little Bear on 6 มิ.ย. 52 14:07

ผมทดลองเปิดสถานีวิทยุออนไลน์ ซึ่งมีหลายสถานี (port) และต้องการให้มันเปิดแบบอัตโนมัติในตอนเปิด server ก็ไปเจอวิธีการและ code ในเว็บนี้

ลองทำตามโค๊ดข้างล่าง

#!/bin/bash
#
# chkconfig: 345  91 35
# description: Starts and stops sc_serv.<br />
#          You know, the mp3 streaming thang.
#
#   Version 1.3 (nov 4 2001)
#   Now with more revisions! System now checks for pid file before cat
#   to display so that we receive no error messages. System also displays
#   pids as we are killing old processes. Profanity was removed from the<br />
#   startup messages. Tests for a pid file before reporting success. Displays
#   the relay server name when we start the daemon up, so that we know
#   which servers are getting booted. Pushed the success marker over to the<br />
#   right and added [] because I am just a slave to fashion.
#
#   Version 1.2 (nov 3 2001)
#   Same exact shit, but runs as nobody for security reasons. Just
#   in case we are worried about buffer overflows or whatnot.
#   
#   Version 1.1 (nov 3 2001)
#   Starts stops and restarts jobs. Also checks for existing daemons
#   before calling a start, and exits without starting new ones. This
#   prevents you from being a dumbass and starting multiple listeners
#   on the same port. I would suggest using the restart command
#   in these cases. Also creates a shoutcast.pid file that can be used
#   to discover all of the (many) pids used by shoutcast when running.
#
#   Version 1.0 (nov 3 2001)<br />
#   Starts and stops successfully.<br />
#   Kills old jobs on start command. Dirty, but<br />
#   does the job well enough. Tested functional on
#   mandrake version 8.1 but should work on redhat<br />
#   or any other distro that supports a standard<br />
#   sysv startup script.
#
#   Instructions for use.
#   1: untargzip shoutcast into the directory of your choosing
#   2: copy sc_serv into the /usr/sbin directory<br />
#   3: Create the directory /etc/shoutcast
#   4: copy the shoutcast.conf file into your /etc/shoutcast dir.
#   5: Edit the shoutcast.conf file to match your needs.
#   6: Make as many more conf files as needed to support<br />
#      multiple streams. Be sure to edit these files so that
#      you are not starting multiple shoutcast servers that
#      are either listening or broadcasting on the same port.
#   7: Copy this file into the /etc/rc.d/init.d directory
#   8: chmod this file +x (chmod ug+x /etc/rc.d/init.d/shoutcast)
#   9: run chkconfig --add shoutcast from the /etc/rc.d/init.d dir.
#   10:Run /etc/rc.d/init.d/shoutcast start<br />
#   11:Drink a beer, or light one up, and enjoy the tunes.
#

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up. This line may cause an error on incompatible
# distributions. Remove it if necessary. Also remove if the startup always
# fails for no apparent reason.
[[ ${NETWORKING} = "no" ]] && exit 0<br />
<br />
<br />
stop (){
 <a class="hashtag" href="/tags/First">#First</a> we want to kill the original servers, so we don't get errors.
  echo "Killing old shoutcast servers."
  for oldpid in `ps -A | grep sc_serv | cut -c 0-6`; do
      kill -9 $oldpid
      if [[ $1 == "-v" ]]
      then
          echo $oldpid
      fi
  done
  rm -f /var/run/shoutcast.pid
}<br />
<br />
<br />
start (){
  <a class="hashtag" href="/tags/Now">#Now</a> we can start the servers up.
  if [[ $1 == "-v" ]]<br />
      then
          echo "Starting up the new shoutcast servers. Starting..."
      fi
    <br />
  servcount=`expr 0`
  for cfile in `ls /etc/shoutcast`; do
      echo -n $cfile
      echo -n " -> "
      grep ^RelayServer /etc/shoutcast/$cfile
      # This is the line where we actually run the shoutcast program!
      <a class="hashtag" href="/tags/sudo">#sudo</a> -u nobody /usr/bin/sc_serv /etc/shoutcast/$cfile > /dev/null &
      /usr/bin/sc_serv /etc/shoutcast/$cfile > /dev/null &
      let servcount=servcount+1
  done
  <a class="hashtag" href="/tags/Create">#Create</a> the pid file...
  ps -A | grep sc_serv | cut -c 0-6 > /var/run/shoutcast.pid
  <a class="hashtag" href="/tags/Done">#Done</a> now!
  echo "Started $servcount servers."
}<br />
<br />
<br />
case "$1" in
  start)    
  if [[ ! -e /var/run/shoutcast.pid ]]
  then
    start $2
    
    if [[ -e /var/run/shoutcast.pid ]]<br />
    then        
        echo "Startup                      [SUCCESS]"
    fi
    
  else
      if [[ $2 == "-v" ]]
      then
        echo "Shoutcast is already running these processes:"
        #Toldja! Checks before displaying pid file.
        if [[ -e /var/run/shoutcast.pid ]]
        then
            cat /var/run/shoutcast.pid
        fi
        echo "Try calling shoutcast restart in order to kill old processes."
    else
        echo "SC_SERV is already running. Try calling shoutcast restart."
    fi
    echo "Startup                      [FAILED]"
  fi
    ;;
  restart)
    stop $2
    if [[ $2 == "-v" ]]
        then
            echo "Waiting for the old servers to die..."
        fi

    sleep 4
    start $2
    if [[ -e /var/run/shoutcast.pid ]]<br />
    then        
        echo "Startup                      [SUCCESS]"
    fi
    ;;
  stop)
  if [[ -e /var/run/shoutcast.pid ]];
  then
    stop $2
    echo "Shoutcast shutdown                   [SUCCESS]"
  else
    echo "There are no registered shoutcast servers running right now. Attempting to kill anyways."
    stop $2
  fi
    ;;
  *)
    echo "Usage: shoutcast (start|stop|restart) [-v]"
    
esac

ขั้นตอนการติดตั้ง

  1. สร้างไฟล์ /etc/init.d/shoutcast แล้วเปลี่ยน attr เป็น 755
  2. copy ไฟล์ sc_serv (ที่ดาวน์โหลดมา) ไปไว้ที่ /usr/bin
  3. สร้างโฟล์เดอร์ /etc/shoutcast แล้วนำไฟล์คอนฟิกมาใส่ไว้ในนี้ จะกี่ไฟล์ก็ได้ ตอนเปิดเครื่องมันจะ start ให้หมด
โดย Little Bear on 5 มิ.ย. 52 12:22

ผมซื้อฮาร์ดดิสใหม่มาติดตั้งใน Ubuntu วิธีการติดตั้งดังนี้

1.ใช้ fdisk และ make.ext3 เพื่อกำหนดพาร์ทิชั่นให้กับฮาร์ดิสตัวใหม่

2.ทำการแบ่งพาร์ทิชั่นใหม่ (fdisk the partiion) บนฮาร์ดดินตัวใหม่โดยใช้โปรแกรม fdisk ตามขั้นตอนด้านล่าง

fdisk /dev/sdb
n
p
1
enter
enter
w

ระวัง หากพลาดจะทำให้ข้อมูลสูญหายทั้งหมดได้นะ

3.สร้าง ext3 filesystem ด้วยคำสั่ง

mkfs.ext3 /dev/sdb1

แล้วฮาร์ดดิสตัวใหม่ก็พร้อมที่จะถูก mount

ปล.อย่าลืมแก้ไขค่า /etc/fstab เพื่อเพิ่ม mount point ให้โดยอัตโนมัติหลังจากเปิดเครื่องซะด้วย

อ้างอิง

  1. install new harddisk on ubuntu box
  2. Ubuntu - How to add or create hard disk partition and make it automatically mount
โดย Little Bear on 4 มิ.ย. 52 23:04

ผมต้องการสำรองไฟล์ข้อมูลของ Express Accounting ทุกวัน โดยให้ใช้ชื่อวันเป็นชื่อไฟล์สำรอง

cd /home

สร้างไฟล์ /home/.backupdata ให้มีคำสั่งดังนี้

#!/bin/bash
DATE=`date +%a`  # Grab the day name of today
TARFILE=/tmp/backup-$DATE.tar.gz # Use it to create a filename
tar cvpfz $TARFILE Sharing > /tmp/backup-$DATE.log 2>&1

กำหนดสิทธิ์ให้เป็น rwxr-xr-x

chmod 755 .backupdata

กำหนดให้ crontab ทำการสำรองข้อมูลทุกวันเวลา 12.30 น. (เวลาพักเที่ยง)

crontab -e

กำหนดเวลาเป็น

30 12 * * *
โดย Little Bear on 4 มิ.ย. 52 00:15

กำลังหาทางติดตั้ง CentOS 5.3 กับ ISPConfig 3.0.1.3 อยู่ ขอเก็บลิงก์ที่เกี่ยวข้องไว้ก่อน

แก้ error "blowfish_secret" ของ phpmyadmin โดยแก้ไขไฟล์ /etc/phpmyadmin/config.inc.php เพิ่มบรรทัดนี้ไว้ด้านล่าง

$cfg['blowfish_secret'] = 'your hash here';

โดยแทน "your hash here" ด้วยอักษร "JFxf53DW3HtalwEkkusnEmjuQ" หรือ อื่น ๆ

ยังติดปัญหาเรื่อง start pure-ftpd ไม่ได้ เลยใช้ proftpd แทนไปก่อน โดยการ

yum install proftpd
service proftpd start
chkconfig --levels 235 proftpd on
โดย Little Bear on 21 พ.ค. 52 17:10

มีงานปรับปรุงที่จะต้องทำเพิ่มเติมในเว็บไซท์ http://wintesla2003.com ให้ SMF ใช้งาน ShoutBox เพื่อจะได้ใช้ฐานข้อมูลรายชื่อของ SMF เลย ดูตัวอย่างได้จากเว็บไซท์ของ JustUser.net แต่ต้องเป็นสมาชิกด้วยนะครับจึงจะใช้งานได้

ขอเก็บข้อมูลและลิงก์สำหรับงานนี้ไว้ก่อน

โดย Little Bear on 28 เม.ย. 52 21:21

Server ของพรรคพวกที่ใช้ทำ Express Accounting เริ่มมีปัญหา อาจจะเกิดจาก Harddisk หรือ Mainboard ยังไม่แน่ใจ แต่คาดว่าจะต้องลงใหม่แน่นอน จึงปิ๊งไอเดียว่า "ถ้าหากใช้ Linux เป็น server แทน Windows Server น่าจะดีกว่า" จึงลองเสาะหาจากอาจารย์กู แล้วลองนำมาประมวลเขียนใหม่อีกที

ตอนแรกว่าจะใช้ CentOS มาทำเป็น server แต่มีปัญหาเรื่องแผ่นนิดหน่อย ก็เลยตัดสินใจใช้ Ubuntu Server แทน

ขั้นตอนการติดตั้ง

1.ติดตั้ง Ubuntu Server โดยไม่ต้องติดตั้ง package ใด ๆ เราจะมาติดตั้ง Samba กันตอนหลัง

2.ติดตั้ง Samba

sudo apt-get install samba

3.แก้ไขคอนฟิกของ Samba

sudo nano /etc/samba/smb.conf

4.เปลี่ยนค่าใน global ของคอนฟิก อย่าลืมสร้าง share directory ด้วยนะ ส่วนกลุ่ม Sharing หากยังไม่มีก็ป้อนเข้าไปใหม่ทั้งหมด

[global]
workgroup = YOUR_WORK_GROUP
netbios name = YOUR_COMPUTER_NAME
security = SHARE
auth methods = guest
domain master = No
wins support = Yes

[Sharing]
comment=My Ubuntu
path = /home/your_home_directory/Sharing
read only = No
guest ok = Yes

5.บันทึกให้เรียบร้อย แล้วสั่ง restart Samba

smbd restart

อ้างอิงจาก

ปล. อาจจะต้องซื้อ server ใหม่ และ คอมมือสอง แบบถูก ๆ มาเพิ่มด้วย

โดย Little Bear on 4 มี.ค. 52 11:12

มีคนรวบรวมและเขียนไว้ให้อ่านแล้ว ขอเก็บลิงค์ไว้ก่อนสำหรับอ้างอิงภายหลัง

ลองอ่านดูแล้ว มีประโยชน์มาก ทั้งต่อคนที่เพิ่งเข้าสู่วงการหรือเข้าสู่วงการนานแล้วแต่ไม่ได้ศึกษา command line อย่างจริงจัง

ตอนนี้เริ่มมี VPS เป็นของตัวเอง ซึ่งสามารถเล่นอะไรได้มากขึ้น แต่ต้องใช้ command line เจ้านี่ก็จะมีประโยชน์เป็นอย่างมากสำหรับผม

ที่มา : http://www.linuxcentrix.com

โดย Little Bear on 16 ก.พ. 52 09:42

ช่วงนี้เป็นช่วงที่ต้องตัดสินใจในเรื่องการตั้ง server ของตนเอง ซึ่งแนวทางล่าสุดคือการซื้อ server สักเครื่องและหาที่วางสักแห่ง งานที่ยากก็คือการติดตั้ง software และ configuration ซึ่งเป็นงานที่ยังไม่เคยทำเลย อาจจะถึงเวลาที่ได้ศึกษาเรื่องนี้อย่างจริงจังเสียที

ลำดับของงานที่ต้องเตรียมการ

  1. หา server สักเครื่อง
  2. หาที่ตั้งเครื่อง ซึ่งมีตัวเลือกทั้งที่กรุงเทพ และหาดใหญ่ (หาดใหญ่จะเริ่มใช้งานได้ประมาณกลางเดือนมีนาคม 52)
  3. ติดตั้ง virtual environment ซึ่งอาจจะใช้ Proxmox VE ที่ดูเหมือนว่าจะติดตั้งง่ายเพราะการกำหนดค่าต่าง ๆ ผ่านหน้าเว็บเสียเป็นส่วนใหญ่ มีวิธีการติดตั้งจาก howtoforge หรือจะเป็น Virtualization With Xen 3.3.1 On Debian Etch ซึ่งดูออกจะยากไปนิด ทุกอย่างอยู่บน command line หมดเลย
  4. หาเครื่องมาจำลองและติดตั้งเพื่อทดลองศึกษาก่อนใช้งานจริง
  5. ติดตั้ง control panel
โดย Little Bear on 4 ก.พ. 52 10:07

หลาย ๆ ครั้งที่ต้องย้าย Hosting ของเว็บไซท์ ISP ที่ผมใช้มักจะได้รับ IP ใหม่ช้ากว่าคนอื่น จึงต้องหาทางเปลี่ยน DNS ของ wvdial ให้ไปใช้ OpenDNS ซึ่งจะทำให้ได้รับ IP ใหม่ทันที

ผมพยายามหาทางกำหนดค่า DNS ของ wvdial จนได้วิธีดังนี้ (ซึ่งไม่รู้ว่าเป็นวิธีที่ถูกต้องหรือไม่)

  1. กำหนดค่า New PPPD ใน /etc/wvdial.conf ให้เป็น no

    #sudo gedit /etc/wvdial.conf
    เพิ่ม/แก้ไข
    New PPPD = no

  2. เพิ่ม nameserver ใน /etc/resolv.conf

    #sudo gedit /etc/resolv.conf
    เพิ่ม
    nameserver 208.67.222.222
    nameserver 208.67.220.220

หากต้องการยกเลิกกลับไปใช้ DNS ของ ISP เหมือนเดิมก็ให้เปลี่ยนค่า New PPPD = yes

617 items|« First « Prev 50 51 (52/62) 53 54 Next » Last »|