Linux安装软件方式
1、rpm包,相当于windows的exe安装
2、tar包,压缩包
3、yum安装,CentOS在线安装
安装JDK
groupadd tomcat
useradd -g tomcat tomcat
rpm -ivh /opt/jdk-7u71-linux-x64.rpm(安装jdk,需创建目录并导入文件)
su - tomcat
vi .bash_profile(配置用户级环境变量)
JAVA_HOME=/usr/java/jdk1.7.0_71
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH
su - root
vi /etc/profile(配置root级环境变量)
JAVA_HOME=/usr/java/jdk1.7.0_71
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
source /etc/profile(立即生效)
echo $PATH(显示PATH内容)
安装MySQL
rpm -qa | grep mysql(查询已安装的MySQL)
rpm -e 查询到的mysql --nodeps(强制删除)
rpm -qa | grep mariadb(查询CentOS7自带的mariadb)
rpm -e 查询到的mariadb --nodeps(强制删除)
cd /opt
mkdir mysql
tar -xvf MySQL-5.5.44-1.linux2.6.x86_64.rpm-bundle.tar -C mysql/(解压到指定目录)
cd mysql
yum install -y perl-Module-Install.noarch(安装perl依赖)
rpm -ivh MySQL-server-5.5.44-1.linux2.6.x86_64.rpm(先装服务端)
rpm -ivh MySQL-client-5.5.44-1.linux2.6.x86_64.rpm(再装客户端)
CentOS-6.5:
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
service iptables save(开启端口远程访问)
CentOS-7:
firewall-cmd --zone=public --add-port=3306/tcp --permanent(开启端口远程访问)
ps -ef | grep mysql(查询已启动mysql服务)
chkconfig --list(查询所有服务的开启与关闭状态)
service mysql start(启动mysql服务)
mysqladmin -u root -p password(修改密码,按提示依次输入原始密码和新密码)
mysql -u root -p(登录mysql)
grant all privileges on *.* to root@'%' identified by 'root' with grant option;
flush privileges;(授权外界连接)
show variables like 'chara%';(查看字符编码)
exit(退出mysql)
cp /usr/share/mysql/my-small.cnf /etc/my.cnf
vi /ect/my.cnf(修改字符编码)
在[client]下加
default_character_set = utf8
在[mysqld]下加
collation_server = utf8_general_ci
character_set_server = utf8
service mysql restart(重启mysql服务)
安装Tomcat
cd /opt
mkdir tomcat
tar -xvf apache-tomcat-7.0.90.tar.gz -C tomcat
CentOS-6.5:
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
service iptables save(开启端口远程访问)
CentOS-7:
firewall-cmd --zone=public --add-port=8080/tcp --permanent(开启端口远程访问)
cd tomcat/apache-tomcat-7.0.90/bin
./startup.sh(启动tomcat)
./shutdown.sh(关闭tomcat)