2009年8月5日 星期三

Setup yum access centos taiwan server list

/etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://ftp.cse.yzu.edu.tw/pub/CentOS/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://ftp.cse.yzu.edu.tw/pub/CentOS/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://ftp.cse.yzu.edu.tw/pub/CentOS/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://ftp.cse.yzu.edu.tw/pub/CentOS/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://ftp.cse.yzu.edu.tw/pub/CentOS/RPM-GPG-KEY-CentOS-5

2009年8月4日 星期二

MySQL ERROR 1045

 

After install LAMP , start mysql fail and user table empty

[root@devphp ~]# mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)



Solution:

mysql 資料庫名稱 -u使用者名稱 -p密碼

tail -f  /var/log/mysqld.log

Re-Install MySQL
yum -y  remove mysql mysql-server php-mysql
yum -y  install  mysql mysql-server php-mysql

service mysqld stop
/usr/libexec/mysqld --skip-grant &
mysql -u root mysql
mysql> use mysql ;
mysql> show tables;
mysql> insert into user values
('localhost','root',password('123'),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'
,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'
,'Y','Y','Y','Y','Y','Y'
,'','','',''
,0,0,0,0);
mysql> quit ;

shell>kill -9  3769 (mysql pid)

shell>service mysqld start

mysql -uroot -p

MySQL ERROR 1130

啟動MySQL
/etc/rc.d/init.d/mysqld start

remote connect fail , and get error ERROR 1130
ERROR 1130: Host '192.168.126.1'  is not allowed to connect to this MySQL server

[root@centos5 /]# su - mysql
-bash-3.2$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user,password from user;
+-----------+------+----------+
| host      | user | password |
+-----------+------+----------+
| localhost | root |          |
| centos5   | root |          |
| 127.0.0.1 | root |          |
+-----------+------+----------+
3 rows in set (0.01 sec)

mysql> update user set host='%' where user='root' ;

 

1。 改表法。可能是你的帳號不允許從遠程登陸,只能在localhost。這個時候只要在localhost的那台電腦,登入mysql后,更改 “mysql” 資料庫里的 “user” 表里的 “host” 項,從”localhost”改稱”%”

mysql -u root -p

mysql>use mysql;

mysql>update user set host = ‘%’  where user =’root’;

mysql>flush privileges;

mysql>select ‘host’,'user’ from user where user=’root’;

現在就可以連接了!

2. 授權法。例如,你想myuser使用mypassword從任何主電腦連接到mysql服務器的話。

GRANT ALL PRIVILEGES ON *.* TO‘myuser’@'%’IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;

如果你想允許使用者myuser從ip為192.168.1.3的主電腦連接到mysql服務器,並使用mypassword作為密碼

GRANT ALL PRIVILEGES ON *.* TO‘myuser’@'192.168.1.3′IDENTIFIED BY ‘mypassword’ WITH

Install LAMP LAMP (Apache, PHP and MySQL in Linux)+ perl using Yum

 

Install LAMP + perl
yum -y install httpd php mysql mysql-server php-mysql perl

Enable Service
chkconfig --level 235 httpd on
chkconfig --level 235 mysqld on

Start httpd
service httpd  start
service mysqld start

Check PHP
cd /var/www/html/
vi index.php
<?php
   phpinfo();
?>

http://192.168.0.131/

image

Install webmin

 

Install wget
yum search wget
yum install wget.i386

Webmin home page : http://www.webmin.com/

Install Perl
yum search perl
yum install perl.i386

Install webmin
mkdir -p /worktmp/webmin
cd /worktmp/webmin
wget http://downloads.sourceforge.net/project/webadmin/webmin/1.480/webmin-1.480-1.noarch.rpm?use_mirror=ncu
rpm -ivh webmin-1.480-1.noarch.rpm

Connect to webmin
http://192.168.0.131:10000/

image

image

centos service control

List Services


[root@devphp ~]# chkconfig --list
haldaemon 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
mcstrans 0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off
multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
netplugd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off


Disable Service



chkconfig --level 0123456 ip6tables off

chkconfig --level 0123456 iptables off



Restart Service



service network restart



List Service Status



service --status-all

2009年8月3日 星期一

colinux + centos 5.2

centos 5.2
colinux-centos52.exe

CentOS-PHP.bat
colinux-daemon  -t nt @CentOS-PHP.conf
CentOS-PHP.conf

cobd0="D:\coLinux\CentOS-PHP\system.img"
cobd7="D:\coLinux\CentOS-PHP\swap512m.img"
#cobd1="CentOS-5.3-i386-bin-DVD.iso"
#cofs0="C:\Program Files\coLinux"
cofs0="D:\"
cofs1="X:\"
kernel="vmlinux"
root=/dev/cobd0 fastboot
#initrd="C:\Program Files\coLinux\initrd.gz"
mem=512
eth0=slirp
eth1=tuntap
eth2=pcap-bridge,"coLinux network",03:50:56:C0:A0:31

 
vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=devphp

vi /etc/sysconfig/network-scripts/ifcfg-eth1

============================================
EVICE=eth1
BOOTPROTO=dhcp
ONBOOT=no
TYPE=Ethernet

============================================
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.168.131
BROADCAST=192.168.168.255
NETMASK=255.255.255.0
NETWORK=192.168.168.0
ONBOOT=yes
TYPE=Ethernet