Monday, November 24, 2008

ubuntu programming howto

記錄用ubuntu開發程式時, 需要的設定

>sudo apt-get install build-essential

> sudo apt-get install manpages
> sudo apt-get install manpages-posix
> sudo apt-get install manpages-posix-dev
> sudo apt-get install ssh
> sudo apt-get install subversion
> sudo apt-get install wireshark
> sudo apt-get install vsftpd
> sudo apt-get install bison
> sudo apt-get install autoconf
> sudo apt-get install flex
> sudo apt-get install gperf

libcurl
>sudo apt-get install libcurl4-openssl-dev

gtk
>sudo apt-get install libgtk2.0-dev

GNOME
>sudo apt-get install gnome-core-devel

minicom

>sudo apt-get install minicom

make menuconfig
>sudo apt-get install ncurses-dev

object c
>sudo apt-get install gobjc++
>sudo apt-get install libgnustep-base-dev
>sudo apt-get install gnustep

libboost
>sudo apt-get install libboost-thread-dev

openssl header file
>sudo apt-get install libssl-dev
or
>sudo apt-get install openssl*

zlib.h
>sudo apt-get install zlib1g-dev

bzip2
>sudo apt-get install libbz2-dev

x11
>sudo apt-get install libx11-dev

linux source
>sudo apt-get install linux-source


========

nfs server
>sudo apt-get install nfs-common nfs-kernel-server
Edit /etc/exports
for example,
/tftpboot 192.168.200.0/24(rw,sync,no_subtree_check,no_root_squash)

>sudo /etc/init.d/nfs-kernel-server restart

Self Test 1
>showmount -e localhost


Self Test 2
nfs client
>mount -t nfs 192.168.200.22:/tftpboot /mnt
or try
>mount -t nfs -o nolock 192.168.200.22:/tftpboot /mnt

Troubleshooting

1.
If fail to start NFS kernel daemon, try to
/etc/init.d/portmap start
or
/etc/init.d/rpcbind restart
Then do "apt-get install nfs-kernel-server" again.

2.
If nfs client still cannot connect to nfs server, try
at client side,
>mount -v -t nfs -o nolock NFS_SERVER_IP:/tftpboot /mnt
observe the message

at server side,
>dmesg
>tail -f /var/log/syslog

If mountd complianed illegal port, then try to add insecure to /etc/exports
/tftpboot 192.168.200.0/24(rw,sync,no_subtree_check,no_root_squash,insecure)

========

tftpd

========

remount
>mount -o remount,rw /wanted_path

gawk
>sudo apt-get install gawk

freetype2
>sudo apt-get install libfreetype6-dev

mysql
>sudo apt-get install mysql-server mysql-client
>sudo apt-get install libmysqlclient16-dev

telnetd
>sudo apt-get install telnetd
>sudo /etc/init.d/openbsd-inetd restart

snmp
>sudo apt-get install snmp

ssh: connect to localhost port 22: Connection refused
>sudo service ssh restart

Read from socket failed: Connection reset by peer
>ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
>ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
>service ssh restart

 =====================================


svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LC_CTYPE is UTF-8
svn: warning: please check that your locale name is correct

Solution:

Add lines below to ~/.bashrc
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

 =====================================

Autostart daemons
>sudo update-rc.d ssh defaults
>sudo update-rc.d apache2 defaults

Troubleshooting:
$update-rc.d ssh defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match ssh Default-Stop values (none)

Solution:
$update-rc.d ssh remove
$update-rc.d ssh defaults

=====================================

Static IP
In /etc/network/interfaces,


auto eth0
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.1.255
gateway 192.168.2.1
safe

DNS
In /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

Finally,
sudo /etc/init.d/networking restart

=====================================
xxx is not in the sudoers file. This incident will be reported

Solution
append the username to sudo in the file /etc/group

=====================================
how to update java version fom 1.6 to 1.7

Solution 1:
update-java-alternatives --jre -s java-1.7.0-openjdk-i386

Solution 2:
# to install add-apt-repository
apt-get install python-softeware-properties
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-install


No comments: