不为失败找借口,只为成功找方法!
分类: LINUX
2013-01-08 08:58:38
1.jdk安装与配制
1).下载JDK1.6(jdk-6u21-linux-i586.bin) 地址: jsp
2).转到安装目录:
[root@localhost webServer]$ cd /usr/local/
修改jdk-6u21-linux-i586.bin执行权限
[root@localhost webServer]$ chmod +x jdk-6u21-linux-i586.bin
3).执行安装命令
[root@localhost webServer]$ ./jdk-6u21-linux-i586.bin 或者rpm -ivh jdk-1_5_0_06-linux-i586-rpm
即安装完成,安装在/usr/local/jdk1.6.0_21
4).安装成功后需要配置jdk环境变量
修改/etc/profile
[root@localhost webServer]$ vi /etc/profile
export JAVA_HOME=/opt/javasoft/jdk1.6.0_25
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
或者
JAVA_HOME=/usr/java/jdk1.5.0_06
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
export JAVA_HOME PATH CLASSPATH
5).修改完/etc/profile保存后 #source /etc/profile使之生效,可以用#export查看path是否添加
6).在终端中输入java -version检查jdk安装是否成功,如果没有成功可能需要重启redhat。
2.tomcat
1)、在终端中转到apache-tomcat-6.0.29.tar.gz所在的目录,输入命令tar -zxvf apache-tomcat-6.0.29.tar.gz //解压
2)、在终端中输入cp -R apache-tomcat-6.0.29 /usr/local/tomcat ;//拷贝apache-tomcat-6.0.29到/usr/local/下并重命名为tomcat
3)、在终端中输入sh /usr/local/tomcat/bin/startup.sh; //启动tomcat
终端显示以下内容,表示成功
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TEMDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/java/jdk1.6.0_01
到此tomcat已经安装完成,现在使用浏览器访问 ,出现tomcat默认页面,说明已经安装成功。
4)配制manager用户
3.mysql
mysql-5.1.57.tar.gz包放在/usr/local/src
cd /usr/local/src
tar -zxvf mysql-5.1.57.tar.gz (-C /usr/xx/ 解压到其他目录)
cd mysql-5.1.57
./configure --prefix=/usr/local/mysql
make
make install
不要急着执行红色部分
为mysql单独建立一个用户
groupadd mysql
useradd mysql -g mysql
cp /usr/local/src/mysql-5.1.57/support-files/my-small.cnf /etc/my.cnf (还有my-medium.conf 、my-large.conf、my-huge.conf)
没有my.cnf报错,大概是cant'write xx.frm (跟目录的权限可能也有关系)
复制之后还是会报错:
Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
修改/etc/my.cnf 添加一行 user=mysql
cd /usr/local/mysql/bin
./mysql_install_db --user=mysql (要先执行以上几步骤) (当前路径下的shell脚本运行需要用带上 ./)
输出:
Installing MySQL system tables...
110904 5:57:47 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
110904 5:57:47 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h localhost password 'new-password'
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
安装系统数据库 mysql和test
警告:--skip-locking过时了,将在未来的版本中被移除,请改用--skip-external-locking 不影响建立系统数据库 只是提示。
可以修改my.cnf 查找--skip-locking 替换为--skip-external-locking 重新./mysql_install_db --user=mysql可以看看就没有提示了 (这个文件log-bin log-format默认开着,也先关了,免得产生日志,做主从复制的时候再开启)
上面告诉你如何方便的启动mysql 并且提醒密码
已经告诉了方法。
./mysqld_safe --user=mysql & (带&表示后台模式 否则当前窗口卡住)
./mysql -u root -p //目前还没有密码 直接就进去了
show databases;
修改密码
/usr/local/mysql/bin/mysqladmin -uroot password 123
或者应该可以
use mysql;
update mysql set password=password('123') where user='root';
flush privileges;
//添加服务
cp /usr/local/src/mysql-5.1.57/support-files/mysql.server /etc/init.d/mysqld
cd /etc/init.d/
chmod +x mysqld //添加可执行权限
//添加自启动
chkconfig mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
service mysqld restart
想在任何路径输入mysql -u root -p 都有效
把 /usr/local/mysql/bin 加到$PATH 变量里:export $PATH.=/usr/local/mysql/bin;
或者给/usr/local/mysql/bin 建立一个软链接到已经在环境变量的路径里:ln -s from to
ln -s /usr/local/mysql/bin /usr/bin (/usr/bin 一般都在环境变量里。可以用echo $PATH;查看)