Linux企业运维--LAMP--mysql-php-memcache

LAMP是指一组通常一起使用来运行动态网站或者服务器的软件名称首字母缩写:

  • LINUX

  • Apache,Nginx

  • Mysql

  • PHP

*************源码安装数据库********************

数据库是“按照数据结构来组织、存储和管理数据的仓库”。是一个长期存储在计算机内的、有组织的、可共享的、统一管理的大量数据的集合

server1 172.25.14.1

从服务端把压缩Linux企业运维--LAMP--mysql-php-memcache_第1张图片包5.7.31下载到server1

 

安装相关依赖
yum install -y cmake  
yum install -y ncurses-devel
yum install -y bison

删除CMakeCache.txt

 cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci -DWITH_BOOST=boost/boost_1_59_0

Linux企业运维--LAMP--mysql-php-memcache_第2张图片

make 

makeinstall

 

在/usr/local/mysql下看到已经下载完毕

Linux企业运维--LAMP--mysql-php-memcache_第3张图片
切换到support-files下复制mysql.server到etc/init.d/mysqld ll可以查看

 Linux企业运维--LAMP--mysql-php-memcache_第4张图片

 

建立一个用户mysql

Linux企业运维--LAMP--mysql-php-memcache_第5张图片

更改~/.bash_profile 文件,修改里面路径

Linux企业运维--LAMP--mysql-php-memcache_第6张图片
重新在bash里启用 ----source ~/.bash_profile

 Linux企业运维--LAMP--mysql-php-memcache_第7张图片

 

 

编辑/etc/my.cnf
Linux企业运维--LAMP--mysql-php-memcache_第8张图片

 

初始化 mysqld --initialize --user=mysql

开启数据库/etc/init.d/mysqld start

Linux企业运维--LAMP--mysql-php-memcache_第9张图片

查看日志会发布一个local密码   -----cat mysqld.log

mysql -p   ------用cat到的密码登陆mysql

为了安全我们要自己更改密码,所以退出mysql
mysql_secure_installation ----更改root用户密码,按指示步骤操作

Linux企业运维--LAMP--mysql-php-memcache_第10张图片

 再登陆mysql  用我们新更改的密码完成登陆

Linux企业运维--LAMP--mysql-php-memcache_第11张图片

Linux企业运维--LAMP--mysql-php-memcache_第12张图片

 

***************源码安装php*******************

 


从服务器下载php源码
解压

Linux企业运维--LAMP--mysql-php-memcache_第13张图片

 

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx  --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring  --enable-bcmath --with-fpm-systemd

Linux企业运维--LAMP--mysql-php-memcache_第14张图片

 Linux企业运维--LAMP--mysql-php-memcache_第15张图片

 


根据上述命令安装,如果有需要依赖性的包,就必须将包下载并且重新执行上述命令

make开始解析
make install

Linux企业运维--LAMP--mysql-php-memcache_第16张图片

 

进入php目录下sapi/fmp/

复制php-fpm.server 到/usr/lib/systemd/system
systemctl daemon-reload 重新加载配置文件

Linux企业运维--LAMP--mysql-php-memcache_第17张图片

 


cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf  复制文件并改名,目的是为了备份
vim php-fpm.conf
Linux企业运维--LAMP--mysql-php-memcache_第18张图片

 

cp www.conf.default www.conf  

Linux企业运维--LAMP--mysql-php-memcache_第19张图片
cd php-7.4.12
cp php.ini-production /usr/local/php/etc/php.ini   复制文件到etc下,并起名php.ini

 

Linux企业运维--LAMP--mysql-php-memcache_第20张图片
vim /usr/local/php/etc/php.ini
Linux企业运维--LAMP--mysql-php-memcache_第21张图片


cd /usr/lib/systemd/system
vim php-fpm.server
Linux企业运维--LAMP--mysql-php-memcache_第22张图片
systemctl daemon-reload            
netstat -antlp | grep :9000   监测9000端口

 Linux企业运维--LAMP--mysql-php-memcache_第23张图片

cd /usr/local/nginx/conf/
vim nginx.conf

 Linux企业运维--LAMP--mysql-php-memcache_第24张图片

 

vim index.php
Linux企业运维--LAMP--mysql-php-memcache_第25张图片

 

nginx
curl localhost php-fpm:9000

Linux企业运维--LAMP--mysql-php-memcache_第26张图片

 

使用浏览器登陆

Linux企业运维--LAMP--mysql-php-memcache_第27张图片
*******phpmyadmin**********

 

下载压缩包phpMyAdmin-5.0.2-all-languages.zip
解压

Linux企业运维--LAMP--mysql-php-memcache_第28张图片

 

mv phpMyAdmin-5.0.2-all-languages myadim   为方便更改名字    
mv myadim /usr/local/nginx/html              移动到html

cd /usr/local/nginx/conf/
vim nginx.conf
Linux企业运维--LAMP--mysql-php-memcache_第29张图片
nginx -s reload

 


cd /usr/local/php/etc/
vim php.ini
Linux企业运维--LAMP--mysql-php-memcache_第30张图片

 Linux企业运维--LAMP--mysql-php-memcache_第31张图片

 

nginx -s reload
systemctl reload php-fpm   平滑重加载

网页登录数据库

Linux企业运维--LAMP--mysql-php-memcache_第32张图片

 

********memcache**********

memcache是一套分布式的高速缓存系统,由Livejournal的Brad Fitzpatrick开发,但目前被许多网站使用以提升网站的访问速度,尤其对于一些大型的、需要频繁访问数据库的网站访问速度提升效果十分显著  。这是一套开源,以BSD license授权发布。

下载 memcache-4.0.5.2.tgz并解压

Linux企业运维--LAMP--mysql-php-memcache_第33张图片

 
yum install -y autoconf   安装相关依赖
vim .bash_profile   ----添加路径
Linux企业运维--LAMP--mysql-php-memcache_第34张图片
source .bash_profile   在bash里重新刷新

 

 phpize
./configure --enable-memcache  

Linux企业运维--LAMP--mysql-php-memcache_第35张图片
 make
 make install
cd /usr/local/php/etc/
 vim php.ini

Linux企业运维--LAMP--mysql-php-memcache_第36张图片
Linux企业运维--LAMP--mysql-php-memcache_第37张图片
systemctl reload php-fpm

Linux企业运维--LAMP--mysql-php-memcache_第38张图片
切换到目录memcache-4.0.5.2下
cp memcache.php example.php /usr/local/nginx/html/  复制

Linux企业运维--LAMP--mysql-php-memcache_第39张图片

 


cd /usr/local/nginx/html/
yum install -y memcached
systemctl  start memcached

netstat -antlp|grep :11211     监听11211端口

Linux企业运维--LAMP--mysql-php-memcache_第40张图片
vim memcache.php
Linux企业运维--LAMP--mysql-php-memcache_第41张图片

 

在浏览器看到捕捉机率

Linux企业运维--LAMP--mysql-php-memcache_第42张图片

 

你可能感兴趣的:(mysql,php,linux)