1. 使用工具将 linux版本jdk与tomcat上传至服务器,并使用tar –zxvf 命令将其解压宿
2. 配置jdk与tomcat环境变量
修改 用户目录下的 .bash_profile文件
例如:/home/zhangsan/.bash_profile
export JAVA_HOME=/home/javadev/jdk1.7.0_05
export CATALINA_HOME=/home/javadev/apache-tomcat-7.0.29
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$CATALINE-HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
在执行./startup.sh,或者./shutdown.sh的时候,爆出了Permission denied,
其实很简单,就是今天在执行tomcat的时候,用户没有权限,而导致无法执行,
用命令chmod 修改一下bin目录下的.sh权限就可以了
如chmod u+x *.sh
3. 测试方问jdk 与tomcat
编写Hello.java javac Hello.java java Hello
进入tomcat bin目录 使用./startup.sh命令启动
**假如SuSE linux 防火墙开了,别的机器是无法访问的,需要了解一下相关知识: 例子 : 我的需求是允许所有地址访问80端口,只允许指定的地址访问22端口
所以我就在FW_SERVICES_EXT_TCP里面写了80,在FW_SERVICES_ACCEPT_EXT里面写了xxxxx(指定地址),tcp,22
结果发现只有80可以访问,22无法访问!!!
纠结了半天发现原文说的FW_SERVICES_EXT_TCP配置会覆盖FW_SERVICES_ACCEPT_EXT配置指的是2种配置方法无法共存的意思。也就是说你只能选择一种方法,而不能一个端口用第一种方法,另一个端口用第二种方法!!开启防火墙命令rcSuSEfirewall2 start 防火墙帮助命令中可已看到其他命令rcSuSEfirewall2 –h
防火墙开放端口 i. 进入 /etc/sysconfig/ 目录,用 vi 命令编辑 SuSEfirewall2 文件,
-># vi SuSEfirewall2 在文件中找到FW_SERVICES_EXT_TCP,在其后面加上服务名或者是服务对应的端口,如SSH,
FW_SERVICES_EXT_TCP=”ssh” 或 FW_SERVICES_EXT_TCP=”22″ 保存之后退出。ii. 重启防火墙,以使配置生效,
-># rcSuSEfirewall2 restart
4.接下来搭建数据库环境(mysql)
4.1 检查mysql rpm相关的包是否安装
rpm -qa | grep -i mysql
mysql-libs-5.1.61-4.el6.x86_64
如果存在删除:
rpm -e mysql-libs-5.1.61-4.el6.x86_64
error: Failed dependencies:
libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
忽略依赖包删除
[root@redis1 ~]# rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64
或者删除依赖包
yum -y remove mysql-libs
rpm -qa | grep -i mysql
4.2 上传下载的安装包MySQL-5.6.28-1.el6.x86_64.rpm-bundle.tar
解压: tar -xvf MySQL-5.6.28-1.el6.x86_64.rpm-bundle.tar
4.3 安装mysql服务端:
rpm -ivh MySQL-server-5.6.28-1.el6.x86_64.rpm
warning: MySQL-server-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by MySQL-server-5.6.28-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by MySQL-server-5.6.28-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by MySQL-server-5.6.28-1.el6.x86_64
缺失依赖包
yum install numactl
rpm -ivh MySQL-server-5.6.28-1.el6.x86_64.rpm
warning: MySQL-server-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
4.4 安装mysql 客户端
rpm -ivh MySQL-client-5.6.28-1.el6.x86_64.rpm
warning: MySQL-client-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
4.5 修改mysql配置文件
vi /etc/my.cnf
[mysqld]
Options for mysqld process:
skip-grant-tables
character_set_server=utf8
lower_case_table_names=1
max_connections=1000
datadir=/var/lib/mysql
[root@mysqlmaster mysql]# service mysql start
Starting MySQL SUCCESS!
**4.6 登录修改root密码**
查看root 用户的密码
cat /root/.mysql_secret
The random password set for the root user at Fri Dec 18 14:12:44 2015 (local time): g478da9wvEZniGqa
root用户登录
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.28
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SET PASSWORD = PASSWORD('root001'); ---设置root用户密码
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
重新登录
[root@mysqlmaster mysql]# mysql -uroot -proot001
4.7 设置root用户支持远程登录:
mysql> select host,user,password from user;
+————-+——+——————————————-+ | host | user | password |
+————-+——+——————————————-+ | localhost | root | *F4368ED34678C82DC260E668501F2FA7201F34EB | |
mysqlmaster | root | *F7FFE6B0AA46DE21A8F0520CE00A0927B01B125D | |
127.0.0.1 | root | *F7FFE6B0AA46DE21A8F0520CE00A0927B01B125D | | ::1 | root | *F7FFE6B0AA46DE21A8F0520CE00A0927B01B125D |
+————-+——+——————————————-+ 4 rows in set (0.00 sec) mysql> update user set
password=password(‘root001’) where user=’root’; Query OK, 3 rows
affected (0.00 sec) Rows matched: 4 Changed: 3 Warnings: 0 mysql>
update user set host=’%’ where user=’root’ and host=’localhost’; Query
OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user,password from user;
+————-+——+——————————————-+ | host | user | password |
+————-+——+——————————————-+ | % | root | *F4368ED34678C82DC260E668501F2FA7201F34EB | | mysqlmaster |
root | *F4368ED34678C82DC260E668501F2FA7201F34EB | | 127.0.0.1 |
root | *F4368ED34678C82DC260E668501F2FA7201F34EB | | ::1 |
root | *F4368ED34678C82DC260E668501F2FA7201F34EB |
+————-+——+——————————————-+ 4 rows in set (0.00 sec) mysql> flush privileges; Query OK, 0 rows
affected (0.00 sec)
5.启动tomcat报错
java.net.UnknownHostException: bogon: bogon: Name or service not known