Linux下安装jdk、tomcat、mysql、Jdk

[b]1、安装JDK:[/b]
直接执行bin文件,在执行钱需要修改文件访问权限
chmod +x jdk-6u7-linux-i586.bin
在jdk目录下:./jdk-6u7-linux-i586.bin
profile配置:(profile文件所有用户共享的文件,在用户登录是运行,.bashrc文件为具体某一用户登录时运行的文件)
export JAVA_HOME=/usr/jdk1.6.0_07
export JRE_HOME=/usr/jdk1.6.0_07/jre
export PATH=$PATH:/usr/jdk1.6.0_07/bin
export CLASSPATH=./:/usr/jdk1.6.0_07/lib:/usr/jdk1.6.0_07/jre/lib

[b]2、安装TOMCAT:[/b]

tar -zxvf apache-tomcat-6.0.10.tar.gz ;//解压
cp -R apache-tomcat-6.0.10 /usr/local/tomcat ;//拷贝apache-tomcat-6.0.10到/usr/local/下并重命名为tomcat
mv apache-tomcat-6.0.10 /usr/local/tomcat ;//移动
mv apache-tomcat-6.0.10 tomcat6 //改名
rm –r apache-tomcat-6.0.10删除

注意乱码:shell>vi /etc/sysconfig/i18n
将LANG=zh_CN.GBK改为LANG=zh_CN.UTF-8
shell>source /etc/sysconfig/i18n

LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:zh_TW.UTF-8:zh_TW:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"


[b]3、安装MySQL:[/b]
rpm -ivh MySQL-server-4.0.16-0.i386.rpm //安装MySQL服务器
rpm -ivh MySQL-client-4.0.16-0.i386.rpm //安装MySQL客户端
MySQL默认没有密码,安装完毕增加密码的重要性是不言而喻的。
   1、命令
   usr/bin/mysqladmin -u root password \'new-password\'
   格式:mysqladmin -u用户名 -p旧密码 password 新密码
2、例子
   例1:给root加个密码123456。
   键入以下命令 :
   /usr/bin/mysqladmin -u root password 123456
   注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。
   3、测试是否修改成功
   1)不用密码登录
   # mysql
   ERROR 1045: Access denied for user: \'root@localhost\' (Using password: NO)
   显示错误,说明密码已经修改。
   2)用修改后的密码登录
   mysql -u root -p
   Enter password: (输入修改后的密码123456)
   Welcome to the MySQL monitor. Commands end with ; or \\g.
   Your MySQL connection id is 4 to server version: 4.0.16-standard
   Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the buffer.
   mysql>
   这是通过mysqladmin命令修改口令,也可通过修改库来更改口令。
如果你想连接你的mysql的时候发生这个错误:
ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server

解决方法:
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user = 'root';mysql>select host, user from user;

2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
[b](或: 1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
2.FLUSH PRIVILEGES;
)[/b]
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.10.40.54' IDENTIFIED BY '123456' WITH GRANT OPTION;


Mysql
1) 安装服务器端
Rpm –ivh MySQL-server-community-5.1.34-0.rhel5.i386.rpm MySQL-client-community-5.1.34-0.rhel5.i386.rpm
2) 安装客户端
rpm -ivh MySQL-client-community-5.1.34-0.rhel5.i386.rpm
3) 修改默认的root用户密码(默认为空)
mysqladmin -uroot password newpassword
4) 启动与停止
启动:/etc/rc.d/init.d/mysql start
停止:/etc/rc.d/init.d/mysql stop
其他参数:
# /etc/rc.d/init.d/mysql
Usage: /etc/rc.d/init.d/mysql {start|stop|restart|reload|force-reload|status} [ MySQL server options ]
5) 选择配置文件
a) 查看所有的配置文件

# find /usr/share/mysql/ -name 'my-*' -print
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-small.cnf
/usr/share/mysql/my-large.cnf

b) 配置文件说明
i. my-innodb-heavy-4G.cnf
This is a MySQL example config file for systems with 4GB of memory
running mostly MySQL using InnoDB only tables and performing complex
queries with few connections.
ii. my-medium.cnf
Example MySQL config file for medium systems.
This is for a system with little memory (32M - 64M) where MySQL plays
an important part, or systems up to 128M where MySQL is used together with
other programs (such as a web server)
iii. my-huge.cnf
Example MySQL config file for very large systems.
This is for a large system with memory of 1G-2G where the system runs mainly
MySQL.
iv. my-small.cnf
Example MySQL config file for small systems.
This is for a system with little memory (<= 64M) where MySQL is only used
from time to time and it's important that the mysqld daemon
doesn't use much resources.
v. my-large.cnf
Example MySQL config file for large systems.
This is for a large system with memory = 512M where the system runs mainly
MySQL.
c) 配置文件使用
You can copy this file to /etc/my.cnf to set global options, mysql-data-dir/my.cnf to set server-specific options (in this installation this directory is /var/lib/mysql) or ~/.my.cnf to set user-specific options.
set global options 全局
set server-specific options 指定数据库服务器
set user-specific options 指定用户
一般拷贝至 /etc/my.cnf 即可(全局有效)。
6) 安装目录介绍
a) /var/lib/mysql/ 数据库文件,日志文件,mysql.sock
atapp atest ib_logfile0 localhost.localdomain.err mysql mysql-bin.000002 mysql-bin.000004 mysql.sock
atbase ibdata1 ib_logfile1 localhost.localdomain.pid mysql-bin.000001 mysql-bin.000003 mysql-bin.index test
b) /usr/share/mysql/ 可选配置文件,mysql.server,语言,字符集
binary-configure czech fill_help_tables.sql japanese my-large.cnf mysql.server norwegian-ny serbian
ChangeLog danish french korean my-medium.cnf mysql_system_tables_data.sql polish slovak
charsets dutch german mi_test_all my-small.cnf mysql_system_tables.sql portuguese spanish
config.huge.ini english greek mi_test_all.res mysqld_multi.server mysql_test_data_timezone.sql romanian swedish
config.medium.ini errmsg.txt hungarian my-huge.cnf mysql_fix_privilege_tables.sql ndb-config-2-node.ini russian ukrainian
config.small.ini estonian italian my-innodb-heavy-4G.cnf mysql-log-rotate norwegian SELinux
c) /usr/bin/ mysql客户端和实用工具程序
# find /usr/bin/ -name 'mysql*' -print
/usr/bin/mysql_install_db
/usr/bin/mysql_fix_privilege_tables
/usr/bin/mysqlimport
/usr/bin/mysql_fix_extensions
/usr/bin/mysql_waitpid
/usr/bin/mysql_find_rows
/usr/bin/mysql_zap
/usr/bin/mysqlhotcopy
/usr/bin/mysql_setpermission
/usr/bin/mysql_upgrade
/usr/bin/mysql_secure_installation
/usr/bin/mysqld_multi
/usr/bin/mysqlslap
/usr/bin/mysqldumpslow
/usr/bin/mysqlcheck
/usr/bin/mysqltest
/usr/bin/mysqlbinlog
/usr/bin/mysqlaccess
/usr/bin/mysql_tzinfo_to_sql
/usr/bin/mysqldump
/usr/bin/mysql
/usr/bin/mysql_convert_table_format
/usr/bin/mysqladmin
/usr/bin/mysqld_safe
/usr/bin/mysqlshow
/usr/bin/mysqlbug
7) 其他
a) 字符集设定
my.cnf文件 [client],[mysqld]下分别添加 default-character-set=utf8
b) 默认存储引擎设定
my.cnf文件 [mysqld]下添加 default-storage-engine=InnoDB
c) 添加公网访问用户(不限IP)
grant all privileges on *.* to yourname@"%" identified by 'yourpassword';
d) 常用命令
i. show variables; 显示mysql配置信息(修改my.cnf后使用该命令检查配置更新)
ii. show variables like '%character%'; 显示字符集信息
iii. show create table tablename; 显示建表脚本
iv. show index from tablename; 显示表索引
v. mysql.server
Usage: ./mysql.server {start|stop|restart|reload|force-reload|status} [ MySQL server options ]
vi. mysqladmin
ping Check if mysqld is alive
processlist Show list of active threads in server
reload Reload grant tables
refresh Flush all tables and close and open logfiles
shutdown Take server down
status Gives a short status message from the server
start-slave Start slave
stop-slave Stop slave
variables Prints variables available
version Get version info from server


安装命令说明:
linux安装、卸载软件用rpm(RedHat package manage)命令,rpm相当于window 的添加删除程序
rpm –qa 列出linux中所有的包
rpm –e 卸载包
rpm –ivh 安装软件
tar –zxvf foo.tar.gz
附注:
| grep 是管道,用于筛选
ps(process)查看进程命令,kill –9 直接杀死进程命令
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值