yum install pcre pcre-devel gcc gcc-c++ zlib zlib-devel openssl openssl-devel libXScrnSaver tkinter tk-devel readline-devel libaio numactl -y
rm -rf /etc/selinux/targeted/active/modules/100/mysql
rm -rf /usr/lib64/mysql
rm -rf /usr/share/mysql
rm -rf /etc/my.cnf
rm -rf /etc/my.cnf.d
cd /home && wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
tar xvf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/usr/local/python3.6
make && make install
ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3
ln -s /usr/local/python3.6/bin/pip3 /usr/bin/pip3
pip3 install --upgrade https://pypi.python.org/packages/7c/9f/57e1404fc9345759e4a732c4ab48ab4dd78fd1e60ee1270442b8850fa75f/tensorflow-1.3.0-cp36-cp36m-manylinux1_x86_64.whl#md5=7a450d33386d17ab85e9e3656551c320
----------------------------------------------
ubuntu22.04安装依赖(nginx 的 ssl pcre等)
1.首先使用dpkg命令查看自己需要的软件是否安装。
例如查看zlib是否安装:
dpkg -l | grep zlib
2.解决依赖包openssl安装,命令:
sudo apt-get install openssl libssl-dev
3.解决依赖包pcre安装,命令:
sudo apt-get install libpcre3 libpcre3-dev
4.解决依赖包zlib安装,命令:
sudo apt-get install zlib1g-dev
-----------------------------------------------
或者
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz && tar xvf Python-3.6.2.tgz && cd Python-3.6.2 && ./configure --prefix=/usr/local/python3.6 && make && make install && ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3 && ln -s /usr/local/python3.6/bin/pip3 /usr/bin/pip3 && pip3 install --upgrade https://pypi.python.org/packages/7c/9f/57e1404fc9345759e4a732c4ab48ab4dd78fd1e60ee1270442b8850fa75f/tensorflow-1.3.0-cp36-cp36m-manylinux1_x86_64.whl#md5=7a450d33386d17ab85e9e3656551c320
##jre
wget http://vr.91city.com/server-jre-8u144-linux-x64.tar.gz && tar -zxvf server-jre-8u144-linux-x64.tar.gz && mkdir /usr/java && mv jdk1.8.0_144 /usr/java/jdk && chown root:root -R /usr/java/jdk/
vi /etc/profile
----------------------
export JAVA_HOME=/usr/java/jdk
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:/usr/local/nginx/sbin:/usr/local/mysql/bin:$PATH
----------------------
#source /etc/profile
测试#java -version
##tomcat
cd /home && wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M26/bin/apache-tomcat-9.0.0.M26.tar.gz && tar -zxvf apache-tomcat-9.0.0.M26.tar.gz && mv apache-tomcat-9.0.0.M26 /usr/local/tomcat
# vim setenv.sh #写入一下命令:
-----------------------------------
#tomcat启动pid
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_BASE=/usr/local/tomcat
#add tomcat pid
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
#add java opts
JAVA_OPTS="-server -XX:PermSize=128M -XX:MaxPermSize=512m -Xms256M -Xmx512M -XX:MaxNewSize=128m"
#JAVA_OPTS="-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m"
---------------------------------------------------
vi /usr/local/tomcat/bin/catalina.sh
-----------------------------
在 # OS specific support. 前面【修改】加入如下代码:
JAVA_HOME=/usr/java/jdk
JRE_HOME=$JAVA_HOME/jre
------------------------------------------
chmod 777 *.sh
----------------------------------------
cd /usr/java/jdk1.8.0_144/jre/lib/security/【修改后,tomcat启动速度快了】
vi java.security
编辑这个文件
将 securerandom.source=file:/dev/urandom
修改为 securerandom.source=file:/dev/./urandom
3、增加tomcat.service
在/usr/lib/systemd/system目录下增加tomcat.service,目录必须是绝对目录
#vim /usr/lib/systemd/system/tomcat.service
写入一下命令:
-----------------------------
[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/tomcat/tomcat.pid
ExecStart=/usr/local/tomcat/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
------------------------------------------
#chmod 754 /usr/lib/systemd/system/tomcat.service && systemctl enable tomcat.service && systemctl start tomcat.service && firewall-cmd --zone=public --add-port=8080/tcp && firewall-cmd --reload
nginx
cd /home && wget http://nginx.org/download/nginx-1.13.4.tar.gz && tar -zxvf nginx-1.13.4.tar.gz && cd nginx-1.13.4 && ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_realip_module --with-pcre && make && make install
--with-pcre 使用系统pcre
--with-pcre=/usr/local/pcre-8.41
vim /usr/lib/systemd/system/nginx.service
--------------------------------------
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
---------------------------------------------
chmod 754 /usr/lib/systemd/system/nginx.service && systemctl enable nginx.service && systemctl start nginx.service && firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --reload
#mysql
cd /home && wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz -C /usr/local
mv /usr/local/mysql-5.7.19-linux-glibc2.12-x86_64 /usr/local/mysql
groupadd mysql && useradd -r -g mysql -s /bin/false mysql
mkdir /usr/local/mysql/mysql-files && chmod 750 /usr/local/mysql/mysql-files && chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/bin/mysqld --initialize --user=mysql #记住临时密码
#缺省SSL和RSA文件:
/usr/local/mysql/bin/mysql_ssl_rsa_setup
开机自启动centos7
vim /usr/lib/systemd/system/mysql.service
--------------------------------------------------
[Unit]
Description=mysql
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/mysql/support-files/mysql.server start
#ExecReload=/usr/local/mysql/support-files/mysql.server restart
#ExecStop=/usr/local/mysql/support-files/mysql.server stop
#PrivateTmp=true
LimitNOFILE=65535 #允许修改mysql连接数
LimitNPROC=65535
[Install]
WantedBy=multi-user.target
--------------------------------------------------
vi /usr/local/mysql/my.cnf
--------------------------------
[client]
port = 1226
#socket = /var/lib/mysql/mysql.sock
default-character-set=utf8
[mysqld]
port = 1226
max_connections=5120 #最大连接数
#socket = /var/lib/mysql/mysql.sock
character-set-server=utf8
#explicit_defaults_for_timestamp=true #如不显示声明Not Null 则为NULL
lower_case_table_names =1 #忽略大小写
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' #[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY
[mysql]
#no-auto-rehash
auto-rehash
default-character-set=utf8
-----------------------------------
chmod 754 /usr/lib/systemd/system/mysql.service
systemctl enable mysql.service
systemctl start mysql.service
#【运行mysql】
firewall-cmd --zone=public --add-port=1226/tcp --permanent
firewall-cmd --reload
source profile
mysql -uroot -p (./mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory)
apt install libncurses*
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('用户的密码');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '用户的密码' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
#可以远程连接mysql了
#pureftpd
cd /home && wget http://vr.91city.com/pure-ftpd-1.0.43.tar.gz && tar -zxvf pure-ftpd-1.0.43.tar.gz && cd pure-ftpd-1.0.43 && ./configure --prefix=/usr/local/pureftpd --without-inetd --with-altlog --with-puredb --with-throttling --with-peruserlimits --with-tls && make && make install
#配置pure-ftpd
cd configuration-file
mkdir -p /usr/local/pureftpd/etc/
cp pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf
cp pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl
chmod 755 /usr/local/pureftpd/sbin/pure-config.pl
vim /usr/local/pureftpd/etc/pure-ftpd.conf
----------------------------------------------
修改如下两处存放目录:
PureDB /usr/local/pureftpd/etc/pureftpd.pdb
PIDFile /usr/local/pureftpd/var/run/pure-ftpd.pid
MinUID 10
NoAnonymous yes #不允许匿名用户连接
PassivePortRange 20000 30000 # 被动模式端口范围
----------------------------------------------
运行 ftpd
/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
useradd www [chown -R www:www /www]
/usr/local/pureftpd/bin/pure-pw useradd ceftp -uwww -d /www
-------------------
Password:
Enter it again:
-------------------
/usr/local/pureftpd/bin/pure-pw mkdb【必须要有】
pure-pw还可以列出当前的ftp账号,也可以删除某个账号:
/usr/local/pureftpd/bin/pure-pw list
【删除用户】/usr/local/pureftpd/bin/pure-pw userdel cftp2
vim /usr/lib/systemd/system/pureftpd.service
-------------------
[Unit]
Description=pureftpd
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
ExecReload=killall pure-ftpd && /usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
ExecStop=killall pure-ftpd
[Install]
WantedBy=multi-user.target
----------------------------
chmod 754 /usr/lib/systemd/system/pureftpd.service
systemctl enable pureftpd.service
systemctl restart pureftpd.serviec
#mkdir -p /www
useradd www
chown -R www. /www
//让pure-pw命令和pure-ftpd命令加入环境变量
ln -s /usr/local/pureftpd/sbin/pure-ftpd /usr/bin/pure-ftpd
ln -s /usr/local/pureftpd/bin/pure-pw /usr/bin/pure-pw
//增加ftpd账号
pure-pw useradd cfpt -uwww -d /www #pwd mytest
//查看ftpd账号列表
pure-pw list
#必须要更新虚拟帐号才会生效:
pure-pw usermod cfpt -u www -g www -m
service pureftpd restart (必须重启)
firewall-cmd --zone=public --add-port=21/tcp --permanent
firewall-cmd --reload
华旅网络 |