源码安装MySQL5.1、Nginx

MySQL安装

#添加用户
useradd mysql
#安装ncurses
yum -y install ncurses*
rpm -qa|grep ncurse
##下载
wget https://downloads.mysql.com/archives/get/file/mysql-5.1.59.tar.gz 
###############
./configure --prefix=/usr/local/mysql --without-debug \
--enable-thread-safe-client --with-pthread --enable-assembler \
--enable-profiling --with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static --with-extra-charsets=all \
--with-plugins=all --with-mysqld-user=mysql --without-embedded-server \
--with-server-suffix=-community \
--with-unix-socket-path=/tmp/mysql.sock
###############
make && make install
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf 

#修改配置文件
#mysql客户端
default-character-set=utf8 
#mysql服务端
character-set-server=utf8
collation-server=utf8_general_ci#校验字符集
default-storage-engine=innodb#存储引擎

###ACL权限
setfacl -m u:mysql:rwx -R /usr/local/mysql/
setfacl -m d:u:mysql:rwx -R /usr/local/mysql/#新建的文件也会赋予权限
#用 acl 来让 mysql 用户对/usr/local/mysql 有所有权限

#创建授权表
/usr/local/mysql/bin/mysql_install_db --user=mysql
##源代码方式启动MySQL
/usr/local/mysql/bin/mysqld_safe --user-mysql&
#设置密码
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
##至此 安装结束

mysql数据库备份等操作

cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql.server
这样就可以了 service mysql.server start
-----------------------
mysqldump -h主机名  -P端口 -u用户名 -p密码 –database 数据库名 > 文件名.sql 
https://www.cnblogs.com/Cherie/p/3309456.html

---------------------
还原MySQL数据库的命令
mysql -hhostname -uusername -ppassword databasename < backupfile.sql

----查看数据库存储引擎
------看数据库提供的引擎
show engines;
------看数据库默认引擎
show variables like '%storage_engine%';

Redis安装

#下载到 /usr/local
wget -O /usr/local http://download.redis.io/releases/redis-4.0.10.tar.gz
#解压
tar zxf redis*
cd redis*
make
# (make后在 src文件中存在命令工具)
make  PREFIX=/usr/local/redis install 
cp redis.conf /usr/local/redis

修改配置文件

#后台运行
daemonize yes
#开机启动
/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf

杀死进程tomcat

setfacl -m u:grq:rwx -R /usr/local/soft/tom7/
setfacl -m d:u:grq:rwx -R /usr/local/soft/tom7/
killid=$(ps -ef |grep AppSrv02 | grep -v "grep AppSrv02" | awk '{print $2}')
kill -9 $killid

Nginx

yum -y install pcre pcre-devel zlib zlib-devel openssl openssl-devel
yum -y install gcc gc-c++ autoconf automake
wget http://nginx.org/download/nginx-1.14.0.tar.gz

#安装 目前只是指定了目录,其他未指定
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
#
make && make install
#开机启动 
echo '/usr/local/nginx/sbin/nginx'>> /etc/rc.local
#ACL权限
setfacl -m u:grq:rwx -R /usr/local/nginx
setfacl -m d:u:grq:rwx -R /usr/local/nginx

猜你喜欢

转载自blog.csdn.net/u012848709/article/details/81284567