alpine lNMP安装部署

2020-03-19  本文已影响0人  茶艺瑶

由于docker多个官方镜像迁移到alpine上,所以我也看看apline的一部linux部署,然后发现安装完之后资源使用率超乎预想

不错不错

image.png
apk add vim

# 设置中国源
vim /etc/apk/repositories
https://mirrors.aliyun.com/alpine/v3.6/main/
https://mirrors.aliyun.com/alpine/v3.6/community/

#查询openssh相关的软件包
apk search  openssh

#安装一个软件包
apk add  xxx   

#删除已安装的xxx软件包
apk del  xxx  

apk update

apk add curl

#提供了查看网络连接的协议端口的命令ss,可以替代netstat命令
apk add iproute2  

#drill 命令可以替代dig和nslookup DNS查询命令
apk add drill   

# 查看建立的TCP连接
ss -ta

apk add openssh-server

#修改配置 /etc/ssh/sshd_config
#如果想root用户登陆
PermitRootLogin yes

#将ssh服务配置为开机自动启动
rc-update add sshd

#如果你想立刻生效,可以执行命令:
/etc/init.d/sshd restart

#相关网络配置
cat /etc/hostname
cat /etc/hosts
cat /etc/resolv.conf
cat /etc/network/interfaces

#重启网络
networking restart

VM-Tools

apk add xf86-video-vmware
apk add open-vm-tools-gtk

modprobe fuse
vmhgfs-fuse .host:/ /mnt/hgfs/

常用命令

reboot #重启系统
poweroff #关机

基本功能模块

apk add alpine-desktop
apk add xfce4
apk add thunar-volman
apk add faenza-icon-theme
apk add leafpad
apk add libreoffice
apk add slim
rc-service dbus start
rc-update add dbus
rc-service udev start
rc-update udev
re-update add slim
apk search vmware
apk add xf86-video-vmware
apk add open-vm-tools-gtk
rc-update add open-vm-tools
reboot

LNMP

# 看情况选择
apk add autoconf dpkg-dev dpkg file g++ gcc  libc-dev make pkgconf re2c git libressl curl tar xz \
#subversion 
#mercurial 
bash \
tini \
tzdata \

#下载php7.4.3

#先来一波扩展安装
apk add autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c

apk add --no-cache ca-certificates curl tar xz openssl

apk add --no-cache --virtual .build-deps argon2-dev coreutils curl-dev libedit-dev libsodium-dev libxml2-dev 

apk add linux-headers oniguruma-dev openssl-dev sqlite-dev 
apk add krb5-dev
apk add bzip2-dev libpng-dev libwebp-dev libjpeg libjpeg-turbo-dev freetype-dev gettext-dev libxslt-dev libzip-dev 

./configure \
--prefix=/usr/local/php \
--with-fpm-user=webu \
--with-fpm-group=webg \
--with-curl \
--with-freetype \
--enable-gd  \
--with-gettext  \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64  \
--with-mysqli \
--with-openssl  \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear  \
--with-webp  \
--with-jpeg \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-bz2 \
--with-mhash \
--enable-fpm \
--enable-bcmath \
--with-libxml \
--with-pcre-jit   \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-xml \
--with-zip \
--without-pear \
--enable-fpm

#添加环境变量
vim /etc/profile

export PATH=$PATH:/usr/local/php/bin

source /etc/profile

# 安装pecl
apk add wget
wget http://pear.php.net/go-pear.phar -O go-pear.php

# composer 
apk add composer git

安装mysql

apk add mysql mysql-client
mysql_install_db --user=mysql --datadir=/var/lib/mysql
rc-service mariadb start
mysqladmin -u root password toor

mysql -uroot -p

CREATE USER 'root'@'%' IDENTIFIED BY '111111';
GRANT ALL ON *.* TO 'root'@'%';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '111111';

nginx

apk add nginx

vim /etc/nginx/nginx.conf

修改 user www;

虚拟机挂载

id www
modprobe fuse
vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000
上一篇下一篇

猜你喜欢

热点阅读