Linux安装常用

一、阿里轻服务器(Anolis OS)(红帽系)

yum upgrade

systemctl enable firewalld  #(默认未启动防火墙)

systemctl start firewalld

firewall-cmd --zone=public --add-port=3306/tcp --permanent

firewall-cmd --zone=public --add-port=81/tcp --permanent

firewall-cmd --zone=public --add-port=80/tcp --permanent

firewall-cmd --reload

yum install mysql-server #2022030309默认8.0.26版

systemctl start mysqld

systemctl enable mysqld

 

mysql -uroot #(默认空密码)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

mysql> show databases;

mysql> use mysql;

mysql> select host,user,authentication_string,plugin from user;

mysql> update user set host='%' where user='root';

mysql> flush privileges;

mysql> exit

 

yum install httpd

vim /etc/httpd/conf/httpd.conf #设置端口等

systemctl enable httpd

yum install nginx

vim /etc/nginx/nginx.conf #设置端口等

systemctl enable nginx

systemctl start httpd
systemctl start nginx

 

yum install php

systemctl enable php-fpm

systemctl start php-fpm

systemctl restart httpd

cd /var/www/html

vim info.php

<?php
phpinfo();
?>

 

二、ubuntu(debin系)

sudo su root

配置IP:

要看子网掩码,“255.255.0.0”设置为“10.0.0.23/16”,掩码有几个1就设置为“/?”

cd /etc/netplan

vim 

netplan apply

apt update #先做

apt upgrade

apt install mysql-server #20220309默认版本8.0.28

#安装后自动启动,自动加自启动

mysql -uroot #也是空密码

vim /etc/mysql/mysql.conf.d/mysqld.cnf //把地址邦定注释
mysql -uroot
select host,user,authentication_string,plugin from user;
update user set host='%' where user='root';
alter user 'root'@'%' identified with mysql_native_password by '123456';
flush privileges;
service mysql resart

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

mysql> show databases;

mysql> use mysql;

mysql> select host,user,authentication_string,plugin from user;

mysql> update user set host='%' where user='root';

mysql> flush privileges;

mysql> exit

 apt install apache2

vim /etc/apache2/apache2.conf

vim /etc/apache2/ports.conf

service apache2 restart

ufw allow 80/tcp  //开放80端口

ufw allow 81/tcp

ufw reload  //重启

apt install nginx

vim /etc/nginx/sites-available/default

 

apt install php #20220309默认版本8.0.8

service apache2 restart

# apache2就可以解释PHP文件,但nginx采用的是不同方式要单独配置

 

 

三、openSUSE

安装后在服务器上:yast2

设置网络ip,子网掩码,“255.255.0.0”设置为“10.0.0.23/16”,掩码有几个1就设置为“/?”

网关是在“路由”里面设置

安装ssh

ssh\http\mysql 加入防火墙的public

设置服务启动、自启动

 

用客户端ssh联接server

zypper upgrade

yast

 

四、oraclelinux(红帽系)

yum upgrade

yum install mysql-server #2022030309默认8.0.26版

systemctl start mysqld

systemctl enable mysqld

 firewall-cmd --zone=public --add-port=3306/tcp --permanent

firewall-cmd --zone=public --add-port=81/tcp --permanent

firewall-cmd --zone=public --add-port=80/tcp --permanent

firewall-cmd --reload

mysql -uroot #(默认空密码)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

mysql> show databases;

mysql> use mysql;

mysql> select host,user,authentication_string,plugin from user;

mysql> update user set host='%' where user='root';

mysql> flush privileges;

mysql> exit

 

posted @ 2022-03-09 09:40  浊鉴  阅读(33)  评论(0编辑  收藏  举报