JDK安装
wget http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz下载jdk
解压.tar.gz:tar -xzvf jdk-8u60-linux-x64.tar.gz
安装.rpm:rpm -ivh jdk-8u60-linux-x64
配置环境变量:
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_60
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:%JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
立即生效:
. /etc/profile("."和"/"间有空格)
java -version看是否安装成功
卸载
.tar.gz的直接删除文件夹和配置的环境变量
rpm的 rpm -qa|grep jdk,rpm -qa|grep gcj查看 rpm -e 查看的结果
rpm -qa |grep httpd
rpm -e --nodeps
MySQL
官网下载安装包:http://dev.mysql.com/downloads/mysql/根据linux的版本下载相应的包
tar -xvf MySQL-5.6.27-1.linux_glibc2.5.x86_64.rpm-bundle.tar
只需安装客户端和服务器端。
rpm -ivh MySQL-server-*
rpm -ivh MySQL-client-*
出现安装的文件与系统文件冲突
解决办法:
卸载rpm -ev --nodeps mysql-libs-5.1.73-5.el6_6.x86_64 mysql-5.1.73-5.el6_6.x86_64
启动mysql /etc/init.d/mysql start
查看是否启动成功:netstat -nat
mysql默认端口号3306表示启动成功。
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决方法:关闭服务/etc/init.d/mysql stop
mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('root') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
create database tvm;
**you must set password before execute this statment--**解决办法
set password=password('123456');
use tvm;
create table employee(empid int(11) not null auto_increment,name varchar(20),sex varchar(10),deprtment varchar(20),primary key(empid))charset=utf8;
查看当前Mysql服务实例使用的字符集
show variables like 'character%';
Apache
安装apache:
tar -zxvf http-2.4.16.tar.gz
cd http*
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-pcre=/usr/local/pcre/bin/pcre-config
make&&make install
解决apr not found问题
tar -zxvf apr-1.4.5.tar.gz
cd apr*
./configure --prefix=/usr/local/apr
make && make install
解决apr-util not found问题
tar -zxvf apr-util-1.3.12.tar.gz
cd apr-util*
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
解决pcre not found问题
tar -zxvf pcre-8.37.tar.gz
cd pcre*
./configure --prefix=/usr/local/pcre
make && make install
编译中间的时候出现libtool:line 990:g++:command not found,执行 yum -y gcc+ gcc-c++
误删/lib64/libgcc_s-4.4.7-20120601.so.1,从好的服务上把该文件拷到相应目录下,然后做软连接即可:ln -s libgcc_s-4.4.7-20120601.so.1 libgcc_s.so.1就行了
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
解决办法:vi /usr/local/apache2/conf/httpd.conf
找到#ServerName www.example.com:80 把#去掉。还可以修改项目路径DocumentRoot "/opt/tvm" <Directory "/opt/tvm">
/usr/local/apache2/bin/apachectl start 启动apache服务
访问ip:10.0.152.19有内容则表示apache配置成功!
PHP5.5
http://php.net/downloads.php下载php包
tar -zxvf php-5.5.30.tar.gz
cd php*
./configure --prefix=/usr/local/php
configure: error: xml2-config not found. Please check your libxml2 installation.
yum install libxml2* -y;
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --with-zlib-dir=/usr/lib
make && make install
cp php.ini-production /usr/local/lib/php.ini
(一定要命名为php.ini,放在/usr/local/lib/路径下;在编译时可以指定php.ini的存放位置,也可以在Apache里指定其位置;如果位置错误,php扩展就不发加载,phpinfo()测试页中看不到扩展信息)
配置Apache中的PHP环境
需要修改Apache的配置文件httpd.conf以得到PHP的解析:
1、在LoadModule中添加:LoadModule php5_module modules/libphp5.so(有则不用管)
2、在AddType application/x-gzip .gz .tgz下面添加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
3、在DirectoryIndex增加 index.php,以便Apache识别PHP格式的index
4、验证PHP环境
新建index.php
内容: