วันศุกร์ที่ 30 กรกฎาคม พ.ศ. 2553

scp

* Using SCP you could copy files remotely. Following is the general syntax.




scp @:



* Here are some examples.



Lets say user 'me' has to send the file with name test to the user 'you', while being in the me's account.



scp test you@192.168.1.1:



* The default destination is /home/you here. Unless you specify otherwise file will be copied on to the default location as in the example above. If you want to specify location, the following example will help you.



scp test you@192.168.1.1:/home/you/directory

วันพฤหัสบดีที่ 29 กรกฎาคม พ.ศ. 2553

web service

http://mpathirage.com/getting-started-with-web-services-in-php-with-ubuntu-804-4/

Denyhosts installed servers

164.115.5.126     http://www.knit.or.th/   denyhosts installed
202.44.11.50       http://www.turpif.or.th/  denyhosts installed
164.115.5.127     http://mail2.knit.or.th/     denyhosts installed
164.115.5.124     http://sp2.knit.or.th/ 

164.115.5.123     http://db.knit.or.th/

164.115.5.122     http://ns.knit.or.th/

164.115.5.128     http://riti.knit.or.th/        denyhosts installed

202.44.11.55      http://www.turpif.or.th/           denyhosts installed

First of all, references to WORK_DIR point to /var/lib/denyhosts/ or something similar on your system.


The default location for the hosts.deny file is /etc/hosts.deny.



Here's the method I used to unblock an IP:



Stop DenyHosts
/etc/init.d/denyhosts stop

Remove the IP address from hosts.deny

Remove all lines containing the IP address from the following files:



WORK_DIR/hosts

WORK_DIR/hosts-restricted

WORK_DIR/hosts-root

WORK_DIR/hosts-valid

WORK_DIR/users-hosts

Consider adding the IP address to WORK_DIR/allowed-hosts

Start DenyHosts

วันอาทิตย์ที่ 25 กรกฎาคม พ.ศ. 2553

uninstall install php 5.3

Check installed program
dpkg --get-selections

sudo apt-get remove --purge

http://php.net/downloads.php
PHP 5.3.3


Complete Source Code

■PHP 5.3.3 (tar.bz2) [10,412Kb] - 22 July 2010

md5: 21ceeeb232813c10283a5ca1b4c87b48

■PHP 5.3.3 (tar.gz) [13,595Kb] - 22 July 2010

md5: 5adf1a537895c2ec933fddd48e78d8a2
 
 
http://hublog.hubmed.org/archives/001924.html
Installing PHP 5.3 etc on Ubuntu Karmic (9.10)


Fetch and extract the latest version of PHP.

sudo apt-get build-dep php5

./configure --prefix=/opt/php5.3 \

--enable-mbstring \

--enable-soap \

--enable-sqlite-utf8 \

--enable-zip \

--with-bz2 \

--with-curl \

--with-gd \

--with-gettext \

--with-gmp \

--with-ldap \

--with-openssl \

--with-xmlrpc \

--with-zlib \

--with-xsl \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-apxs2=/usr/bin/apxs2

make

sudo make -i install

(-i to ignore the error about httpd.conf)

sudo ln -s /etc/php5/apache2/php.ini /opt/php5.3/lib/php.ini

Optional: install APCsudo /opt/php5.3/bin/pecl install apc-beta

sudo nano /opt/php5.3/lib/php.ini

extension_dir = "/opt/php5.3/lib/php/extensions/no-debug-non-zts-20090626"

extension=apc.so

Optional: install FirePHPsudo /opt/php5.3/bin/pear channel-discover pear.firephp.org

sudo /opt/php5.3/bin/pear install firephp/FirePHPCore

sudo apache2ctl restart

http://thirdpartycode.com/2009/08/building-php-5-3-packages-on-ubuntu-9-04-jaunty-for-apache-2/
Prep your system


Setup your development server to be able to compile things. By default, most installations will not come with compilers installed.

view sourceprint?

1 apt-get install checkinstall

Say yes, and let it follow the dependencies as needed.

Get the development headers for some of the extensions you’ll be compiling in.

view sourceprint?

1 apt-get install postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common postgresql-server-dev-8.3



2 aptitude install mysql-client mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 mysql-server-core-5.0



3



4 apt-get install libtidy-dev curl libcurl4-openssl-dev libcurl3 libcurl3-gnutls zlib1g zlib1g-dev libxslt1-dev libzip-dev libzip1 libxml2 libsnmp-base libsnmp15 libxml2-dev libsnmp-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev zlib1g zlib1g-dev libfreetype6 libfreetype6-dev libbz2-dev libxpm4-dev libmcrypt-dev libmcrypt4

Download PHP and Compile it

view sourceprint?

mkdir ~/srcs
cd ~/srcs
wget http://us3.php.net/get/php-5.3.0.tar.gz/from/this/mirror
tar xvfz php-5-3-0.tar.gz
cd php-5.3.0

Now, you can either do the ./configure –help and pick your options, or you can use my configure options for PHP 5.3

./configure --prefix=/opt/php5.3 \
--enable-mbstring \
--enable-soap \
--enable-sqlite-utf8 \
--enable-zip \
--with-bz2 \
--with-curl \
--with-gd \
--with-gettext \
--with-gmp \
--with-ldap \
--with-openssl \
--with-xmlrpc \
--with-zlib \
--with-xsl \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-apxs2=/usr/bin/apxs2

View sourceprint?
make
make test
checkinstall

checkinstall will ask you some basic questions about the package, answer and let it build the package for you. You will run into an interesting issue at first, apxs2 will complain about a LoadModule not being in the httpd.conf file. This is an artifact of how Ubuntu/Debian likes to handle it’s configuration files. The simplest thing is to add a line at the bottom of your httpd.conf that loads a benign module. Mod Pony seems cute .



Configure your PHP like any normal apache server. Reload apache, put the handy phpinfo(); in your documentroot, and then have fun.

Be sure to remove the phpinfo(); from your production servers.



If you want MySQL 5.1, just do apt-get install mysql-server-5.1 , be sure to change the dev header packages to the same version as well.


I got this error when trying to configure php 5.2.6:




configure: error: xml2-config not found. Please check your libxml2 installation.



I’m using Debian and it showed that I had libxml2 installed (and it was the latest version).



It turns out that the latest stable version of libxml2 doesn’t include a file named xml2-config. I suppose I could have linked that file to the config file that the stable version of libxml2 uses, but the easy fix is to just install the newer development version of libxml2 using the following command:



apt-get install libxml2-dev

Ununtu server setup

apt-get install ubuntu-desktop

Ubuntu 10.4 installation

Step 0
During installation, select apache-php-mysql server + openssh server
Change networking from auto to manual
Input   ip address, network mask, gateway, dns server



Step 1  vi /etc/ssh/sshd_config

add
AllowUsers root viroteb
to #Authentication

restart with
/etc/init.d/ssh restart

Improve vi by install vim-nox
aptitude install vim-nox


Step 2  if  you want to change IP later,
vi /etc/network/interfaces
# This file describes the network interfaces available on your system


# and how to activate them. For more information, see interfaces(5).



# The loopback network interface

auto lo

iface lo inet loopback



# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.0.100

netmask 255.255.255.0

network 192.168.0.0

broadcast 192.168.0.255

gateway 192.168.0.1

/etc/init.d/networking restart


Step 3 vi /etc/hosts

127.0.0.1 localhost.localdomain localhost


192.168.0.100 server1.example.com server1



# The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

echo server1.example.com > /etc/hostname


... and reboot the server:


reboot

Afterwards, run




hostname

hostname -f



Both should show server1.example.com now.




Step 4 Edit /etc/apt/sources.list. Comment out or remove the installation CD from the file and make sure that the universe and multiverse repositories are enabled. It should look like this:


vi /etc/apt/sources.list
aptitude update



to update the apt package database and


aptitude safe-upgrade



to install the latest updates (if there are any). If you see that a new kernel gets installed as part of the updates, you should reboot the system afterwards:


reboot


Step 5 aptitude install ntp ntpdate

Step  6  Install postfix
            aptitude install postfix

Step 7 Install phpmyadmin
apt-get install phpmyadmin


To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf, first type the following command to open up this file:

vi  /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:

Include /etc/phpmyadmin/apache.conf



Now restart Apache:

sudo /etc/init.d/apache2 restart


Step 8 Install webmin
http://viroteb.blogspot.com/2010/06/how-to-install-webmin.html

Step 8 Install syslog-ng
apt-get install syslog-ng

change the path to syslog-ng in System configuration in webmin
to /etc/syslog-ng/syslog-ng.conf  so that webmin can view the syslog-ng

Step 9 Install denyhosts
apt-get install denyhosts

วันพฤหัสบดีที่ 22 กรกฎาคม พ.ศ. 2553