[toc]
阿里云使用centos
登录
http://www.aliyun.com/
点击登录
进入控制
https://home.console.aliyun.com/
云服务器
运行中
把ip输入
软件下载
链接:http://pan.baidu.com/s/1i4f2FRn 密码:17s6
mysql搭建
检查硬盘有mysql
rpm -qa | grep mysql
有的话,我们就通过 rpm -e 命令 或者 rpm -e –nodeps 命令来卸载掉
rpm -e mysql // 普通删除模式
rpm -e --nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
yum install -y mysql-server mysql mysql-devel
命令将mysql mysql-server mysql-devel都安装好(注意:安装mysql时我们并不是安装了mysql客户端就相当于安装好了mysql数据库了,我们还需要安装mysql-server服务端才行)
Loaded plugins: langpacks
base | 3.6 kB 00:00
epel | 4.3 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/7): base/7/x86_64/group_gz | 155 kB 00:00
(2/7): epel/x86_64/group_gz | 169 kB 00:00
(3/7): epel/x86_64/updateinfo | 438 kB 00:00
(4/7): extras/7/x86_64/primary_db | 90 kB 00:00
(5/7): updates/7/x86_64/primary_db | 953 kB 00:00
(6/7): epel/x86_64/primary_db | 3.7 MB 00:03
(7/7): base/7/x86_64/primary_db | 5.3 MB 00:05
No package mysql-server available.
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.44-2.el7.centos will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.44-2.el7.centos for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
---> Package mariadb-devel.x86_64 1:5.5.44-2.el7.centos will be installed
--> Processing Dependency: openssl-devel(x86-64) for package: 1:mariadb-devel-5.5.44-2.el7.centos.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.40-1.el7_0 will be updated
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7.centos will be an update
---> Package openssl-devel.x86_64 1:1.0.1e-51.el7_2.1 will be installed
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-51.el7_2.1 for package: 1:openssl-devel-1.0.1e-51.el7_2.1.x86_64
--> Processing Dependency: zlib-devel(x86-64) for package: 1:openssl-devel-1.0.1e-51.el7_2.1.x86_64
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.1e-51.el7_2.1.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.13.2-10.el7 will be installed
--> Processing Dependency: krb5-libs(x86-64) = 1.13.2-10.el7 for package: krb5-devel-1.13.2-10.el7.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.13.2-10.el7.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.13.2-10.el7.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.13.2-10.el7.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.13.2-10.el7.x86_64
--> Processing Dependency: libkdb5.so.8()(64bit) for package: krb5-devel-1.13.2-10.el7.x86_64
--> Processing Dependency: libkadm5srv_mit.so.9()(64bit) for package: krb5-devel-1.13.2-10.el7.x86_64
---> Package openssl-libs.x86_64 1:1.0.1e-34.el7_0.7 will be updated
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-34.el7_0.7 for package: 1:openssl-1.0.1e-34.el7_0.7.x86_64
---> Package openssl-libs.x86_64 1:1.0.1e-51.el7_2.1 will be an update
---> Package zlib-devel.x86_64 0:1.2.7-15.el7 will be installed
--> Processing Dependency: zlib = 1.2.7-15.el7 for package: zlib-devel-1.2.7-15.el7.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package krb5-libs.x86_64 0:1.11.3-49.el7 will be updated
---> Package krb5-libs.x86_64 0:1.13.2-10.el7 will be an update
---> Package libcom_err-devel.x86_64 0:1.42.9-7.el7 will be installed
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-7.el7 for package: libcom_err-devel-1.42.9-7.el7.x86_64
---> Package libselinux-devel.x86_64 0:2.2.2-6.el7 will be installed
--> Processing Dependency: libsepol-devel >= 2.1.9-1 for package: libselinux-devel-2.2.2-6.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.2.2-6.el7.x86_64
--> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.2.2-6.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
---> Package openssl.x86_64 1:1.0.1e-34.el7_0.7 will be updated
---> Package openssl.x86_64 1:1.0.1e-51.el7_2.1 will be an update
---> Package zlib.x86_64 0:1.2.7-13.el7 will be updated
---> Package zlib.x86_64 0:1.2.7-15.el7 will be an update
--> Running transaction check
---> Package libcom_err.x86_64 0:1.42.9-4.el7 will be updated
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-4.el7 for package: e2fsprogs-1.42.9-4.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-4.el7 for package: e2fsprogs-libs-1.42.9-4.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-4.el7 for package: libss-1.42.9-4.el7.x86_64
---> Package libcom_err.x86_64 0:1.42.9-7.el7 will be an update
---> Package libsepol-devel.x86_64 0:2.1.9-3.el7 will be installed
---> Package pcre-devel.x86_64 0:8.32-15.el7 will be installed
--> Processing Dependency: pcre(x86-64) = 8.32-15.el7 for package: pcre-devel-8.32-15.el7.x86_64
--> Running transaction check
---> Package e2fsprogs.x86_64 0:1.42.9-4.el7 will be updated
---> Package e2fsprogs.x86_64 0:1.42.9-7.el7 will be an update
---> Package e2fsprogs-libs.x86_64 0:1.42.9-4.el7 will be updated
---> Package e2fsprogs-libs.x86_64 0:1.42.9-7.el7 will be an update
---> Package libss.x86_64 0:1.42.9-4.el7 will be updated
---> Package libss.x86_64 0:1.42.9-7.el7 will be an update
---> Package pcre.x86_64 0:8.32-12.el7 will be updated
---> Package pcre.x86_64 0:8.32-15.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mariadb x86_64 1:5.5.44-2.el7.centos base 8.9 M
mariadb-devel x86_64 1:5.5.44-2.el7.centos base 748 k
Installing for dependencies:
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.13.2-10.el7 base 649 k
libcom_err-devel x86_64 1.42.9-7.el7 base 30 k
libselinux-devel x86_64 2.2.2-6.el7 base 174 k
libsepol-devel x86_64 2.1.9-3.el7 base 71 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
openssl-devel x86_64 1:1.0.1e-51.el7_2.1 updates 1.2 M
pcre-devel x86_64 8.32-15.el7 base 478 k
zlib-devel x86_64 1.2.7-15.el7 base 50 k
Updating for dependencies:
e2fsprogs x86_64 1.42.9-7.el7 base 697 k
e2fsprogs-libs x86_64 1.42.9-7.el7 base 165 k
krb5-libs x86_64 1.13.2-10.el7 base 843 k
libcom_err x86_64 1.42.9-7.el7 base 40 k
libss x86_64 1.42.9-7.el7 base 45 k
mariadb-libs x86_64 1:5.5.44-2.el7.centos base 754 k
openssl x86_64 1:1.0.1e-51.el7_2.1 updates 711 k
openssl-libs x86_64 1:1.0.1e-51.el7_2.1 updates 950 k
pcre x86_64 8.32-15.el7 base 418 k
zlib x86_64 1.2.7-15.el7 base 89 k
Transaction Summary
================================================================================
Install 2 Packages (+ 9 Dependent packages)
Upgrade ( 10 Dependent packages)
Total download size: 17 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/21): e2fsprogs-libs-1.42.9-7.el7.x86_64.rpm | 165 kB 00:00
(2/21): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00
(3/21): e2fsprogs-1.42.9-7.el7.x86_64.rpm | 697 kB 00:00
(4/21): krb5-devel-1.13.2-10.el7.x86_64.rpm | 649 kB 00:00
(5/21): libcom_err-1.42.9-7.el7.x86_64.rpm | 40 kB 00:00
(6/21): libcom_err-devel-1.42.9-7.el7.x86_64.rpm | 30 kB 00:00
(7/21): libselinux-devel-2.2.2-6.el7.x86_64.rpm | 174 kB 00:00
(8/21): libsepol-devel-2.1.9-3.el7.x86_64.rpm | 71 kB 00:00
(9/21): libss-1.42.9-7.el7.x86_64.rpm | 45 kB 00:00
(10/21): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00
(11/21): krb5-libs-1.13.2-10.el7.x86_64.rpm | 843 kB 00:00
(12/21): mariadb-devel-5.5.44-2.el7.centos.x86_64.rpm | 748 kB 00:00
(13/21): mariadb-libs-5.5.44-2.el7.centos.x86_64.rpm | 754 kB 00:00
(14/21): openssl-1.0.1e-51.el7_2.1.x86_64.rpm | 711 kB 00:01
(15/21): openssl-devel-1.0.1e-51.el7_2.1.x86_64.rpm | 1.2 MB 00:01
(16/21): pcre-8.32-15.el7.x86_64.rpm | 418 kB 00:00
(17/21): openssl-libs-1.0.1e-51.el7_2.1.x86_64.rpm | 950 kB 00:00
(18/21): pcre-devel-8.32-15.el7.x86_64.rpm | 478 kB 00:00
(19/21): zlib-1.2.7-15.el7.x86_64.rpm | 89 kB 00:00
(20/21): zlib-devel-1.2.7-15.el7.x86_64.rpm | 50 kB 00:00
(21/21): mariadb-5.5.44-2.el7.centos.x86_64.rpm | 8.9 MB 00:08
--------------------------------------------------------------------------------
Total 1.6 MB/s | 17 MB 00:10
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libcom_err-1.42.9-7.el7.x86_64 1/31
Updating : zlib-1.2.7-15.el7.x86_64 2/31
Updating : krb5-libs-1.13.2-10.el7.x86_64 3/31
Updating : 1:openssl-libs-1.0.1e-51.el7_2.1.x86_64 4/31
Updating : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 5/31
Installing : zlib-devel-1.2.7-15.el7.x86_64 6/31
Updating : e2fsprogs-libs-1.42.9-7.el7.x86_64 7/31
Updating : libss-1.42.9-7.el7.x86_64 8/31
Installing : libcom_err-devel-1.42.9-7.el7.x86_64 9/31
Installing : libsepol-devel-2.1.9-3.el7.x86_64 10/31
Updating : pcre-8.32-15.el7.x86_64 11/31
Installing : pcre-devel-8.32-15.el7.x86_64 12/31
Installing : libselinux-devel-2.2.2-6.el7.x86_64 13/31
Installing : libverto-devel-0.2.5-4.el7.x86_64 14/31
Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 15/31
Installing : krb5-devel-1.13.2-10.el7.x86_64 16/31
Installing : 1:openssl-devel-1.0.1e-51.el7_2.1.x86_64 17/31
Installing : 1:mariadb-devel-5.5.44-2.el7.centos.x86_64 18/31
Updating : e2fsprogs-1.42.9-7.el7.x86_64 19/31
Installing : 1:mariadb-5.5.44-2.el7.centos.x86_64 20/31
Updating : 1:openssl-1.0.1e-51.el7_2.1.x86_64 21/31
Cleanup : 1:openssl-1.0.1e-34.el7_0.7.x86_64 22/31
Cleanup : e2fsprogs-1.42.9-4.el7.x86_64 23/31
Cleanup : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 24/31
Cleanup : 1:openssl-libs-1.0.1e-34.el7_0.7.x86_64 25/31
Cleanup : krb5-libs-1.11.3-49.el7.x86_64 26/31
Cleanup : e2fsprogs-libs-1.42.9-4.el7.x86_64 27/31
Cleanup : libss-1.42.9-4.el7.x86_64 28/31
Cleanup : libcom_err-1.42.9-4.el7.x86_64 29/31
Cleanup : zlib-1.2.7-13.el7.x86_64 30/31
Cleanup : pcre-8.32-12.el7.x86_64 31/31
Verifying : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64 1/31
Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 2/31
Verifying : 1:mariadb-5.5.44-2.el7.centos.x86_64 3/31
Verifying : pcre-devel-8.32-15.el7.x86_64 4/31
Verifying : zlib-devel-1.2.7-15.el7.x86_64 5/31
Verifying : 1:mariadb-devel-5.5.44-2.el7.centos.x86_64 6/31
Verifying : libverto-devel-0.2.5-4.el7.x86_64 7/31
Verifying : pcre-8.32-15.el7.x86_64 8/31
Verifying : zlib-1.2.7-15.el7.x86_64 9/31
Verifying : krb5-libs-1.13.2-10.el7.x86_64 10/31
Verifying : e2fsprogs-libs-1.42.9-7.el7.x86_64 11/31
Verifying : libselinux-devel-2.2.2-6.el7.x86_64 12/31
Verifying : 1:openssl-devel-1.0.1e-51.el7_2.1.x86_64 13/31
Verifying : libcom_err-1.42.9-7.el7.x86_64 14/31
Verifying : e2fsprogs-1.42.9-7.el7.x86_64 15/31
Verifying : libss-1.42.9-7.el7.x86_64 16/31
Verifying : 1:openssl-libs-1.0.1e-51.el7_2.1.x86_64 17/31
Verifying : 1:openssl-1.0.1e-51.el7_2.1.x86_64 18/31
Verifying : krb5-devel-1.13.2-10.el7.x86_64 19/31
Verifying : libsepol-devel-2.1.9-3.el7.x86_64 20/31
Verifying : libcom_err-devel-1.42.9-7.el7.x86_64 21/31
Verifying : e2fsprogs-libs-1.42.9-4.el7.x86_64 22/31
Verifying : e2fsprogs-1.42.9-4.el7.x86_64 23/31
Verifying : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 24/31
Verifying : pcre-8.32-12.el7.x86_64 25/31
Verifying : 1:openssl-1.0.1e-34.el7_0.7.x86_64 26/31
Verifying : 1:openssl-libs-1.0.1e-34.el7_0.7.x86_64 27/31
Verifying : zlib-1.2.7-13.el7.x86_64 28/31
Verifying : libss-1.42.9-4.el7.x86_64 29/31
Verifying : libcom_err-1.42.9-4.el7.x86_64 30/31
Verifying : krb5-libs-1.11.3-49.el7.x86_64 31/31
Installed:
mariadb.x86_64 1:5.5.44-2.el7.centos
mariadb-devel.x86_64 1:5.5.44-2.el7.centos
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7
krb5-devel.x86_64 0:1.13.2-10.el7
libcom_err-devel.x86_64 0:1.42.9-7.el7
libselinux-devel.x86_64 0:2.2.2-6.el7
libsepol-devel.x86_64 0:2.1.9-3.el7
libverto-devel.x86_64 0:0.2.5-4.el7
openssl-devel.x86_64 1:1.0.1e-51.el7_2.1
pcre-devel.x86_64 0:8.32-15.el7
zlib-devel.x86_64 0:1.2.7-15.el7
Dependency Updated:
e2fsprogs.x86_64 0:1.42.9-7.el7 e2fsprogs-libs.x86_64 0:1.42.9-7.el7
krb5-libs.x86_64 0:1.13.2-10.el7 libcom_err.x86_64 0:1.42.9-7.el7
libss.x86_64 0:1.42.9-7.el7 mariadb-libs.x86_64 1:5.5.44-2.el7.centos
openssl.x86_64 1:1.0.1e-51.el7_2.1 openssl-libs.x86_64 1:1.0.1e-51.el7_2.1
pcre.x86_64 0:8.32-15.el7 zlib.x86_64 0:1.2.7-15.el7
Complete!
但是安装失败,查询了知道Centos7中用MariaDB代替了mysql
下载MySQL 5.6.14
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz
可以到 链接:http://pan.baidu.com/s/1qXnvV7A 密码:9dc6
tar xvf mysql-5.6.14.tar.gz
cd mysql-5.6.14
编译安装
cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/usr/local/mysql/data \-DSYSCONFDIR=/etc \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install
编译的参数可以参考http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html
设置权限
cat /etc/passwd | grep mysql 查看用户列表
cat /etc/group | grep mysql 查看用户组列表
配置
创建目录(log目录是存放mysql日志的地方)
进入安装路径
cd /usr/local/mysql
执行初始化配置脚本,创建系统自带的数据库和表
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
添加防火墙
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
启动mysql
添加服务,拷贝服务脚本到init.d目录,并设置开机启动
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start --启动MySQL
错误
service mysql start
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/iZ94zt0x0agZ.pid).
进/etc
把my.cnf改my.cnf.bak
cd /etc
mv /etc/my.cnf my.cnf.bak
1、可能是/usr/local/mysql/data/mysql.pid文件没有写的权限
解决方法 :给予权限,执行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data” 然后重新启动mysqld!
2、可能进程里已经存在mysql进程
解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9 进程号”杀死,然后重新启动mysqld!
3、可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。
解决方法:去mysql的数据目录/data看看,如果存在mysql-bin.index,就赶快把它删除掉吧,它就是罪魁祸首了。本人就是使用第三条方法解决的 !
4、mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]节下有没有指定数据目录(datadir)。
解决方法:请在[mysqld]下设置这一行:datadir = /usr/local/mysql/data
5、skip-federated字段问题
解决方法:检查一下/etc/my.cnf文件中有没有没被注释掉的skip-federated字段,如果有就立即注释掉吧。
6、错误日志目录不存在
解决方法:使用“chown” “chmod”命令赋予mysql所有者及权限
7、selinux惹的祸,如果是centos系统,默认会开启selinux
解决方法:关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。
检查
netstat -lntp | grep 3306
修改/etc/profile文件,在文件末尾添加
PATH=/usr/local/mysql/bin:$PATH
export PATH
关闭文件,运行下面的命令,让配置立即生效
source /etc/profile
修改密码
mysqladmin -u root password '密码'
登陆mysql
mysql -u root -p
jdk搭建
下载
http://www.oracle.com/technetwork/java/javase/downloads/index.html
http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.rpm
安装
rpm -ivh jdk-8u65-linux-x64.rpm
检查是否安装
java -version
配置环境变量
vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_65
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASS_PATH PATH
source /etc/profile
下载jdk6
http://download.oracle.com/otn-pub/java/jdk/6u41-b02/jdk-6u41-linux-i586.bin
http://download.oracle.com/otn-pub/java/jdk/6u41-b02/jdk-6u41-linux-x64-rpm.bin
http://download.oracle.com/otn-pub/java/jdk/7u15-b03/jdk-7u15-linux-x64.rpm
http://download.oracle.com/otn-pub/java/jdk/7u15-b03/jdk-7u15-linux-x64.tar.gz
解压
unzip jdk-6u23-linux-i586-rpm.bin
rpm -ivh jdk-6u41-linux-amd64.rpm
在/etc/profile末尾
JAVA_HOME=/usr/java/jdk1.8.0_65
改/usr/java/jdk1.6.0_41
source /etc/profile
tomcat搭建
http://apache.dataguru.cn/tomcat/tomcat-9/v9.0.0.M1/bin/apache-tomcat-9.0.0.M1.tar.gz
安装
链接:http://pan.baidu.com/s/1gekW1kJ 密码:rket
tar -zxv -f apache-tomcat-9.0.0.M1-src.tar.gz
rm -rf apache-tomcat-9.0.0.M1-src.tar.gz
mv apache-tomcat-9.0.0.M1-src.tar.gz tomcat
启动
/usr/local/Tomcat/bin/startup.sh
错误
/usr/local/Tomcat/bin/startup.sh: Permission denied
权限
cd /usr/local/Tomcat/bin/
chmod u+x *.sh
建立log
mkdir /usr/local/Tomcat/logs
防火墙开放8080端口
vi + /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
启动
/usr/local/Tomcat/bin/startup.sh
进入阿里云访问
http://120.*.72.5:8080/
参考:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html
http://www.cnblogs.com/xiongpq/p/3384681.html