脚本自动创建一个小于10M的Linux系统,Mysql安装脚
分类:计算机网络

  1. 确定FTP Server的共享目录
    为FTP Server建立一个FTP工作目录,在此设定为/home/ftp
  2. 编写FTP Server初始设置的Shell程序(setup)
    用编辑工具(如vi)编写一个Shell程序,用于对系统进行设置。
    #!/bin/sh
    case $# in
    0) ftphome="`grep '^ftp:' /etc/passwd | cut -d: -f6`"
    ;;
    1) if [ "$1" = "start" ]; then
    ftphome="`grep '^ftp:' /etc/passwd | cut -d: -f6`"
    else
    ftphome=$1
    fi
    ;;
    *) echo "Usage: $0 [anon-ftp-root]"
    exit 1
    ;;
    esac
    if [ -z "${ftphome}" ]; then
    echo "$0: ftphome must be non-null"
    exit 2
    fi
    if [ "${ftphome}" = "/" -o "${ftphome}" = "/usr" ]; then
    echo "$0: ftphome must not be / or /usr"
    exit 2
    fi
    if [ ! -d ${ftphome} ]; then
    mkdir ${ftphome}
    fi
    if [ ! -d ${ftphome}/usr/bin ]; then
    mkdir -p ${ftphome}/usr/bin
    fi
    cp /usr/bin/ls ${ftphome}/usr/bin
    chmod 111 ${ftphome}/usr/bin/ls
    chown root ${ftphome}/usr/bin
    chmod 555 ${ftphome}/usr/bin
    if [ -r ${ftphome}/bin ]; then
    mv -f ${ftphome}/bin ${ftphome}/Obin
    fi
    ln -s usr/bin ${ftphome}
    if [ ! -d ${ftphome}/usr/lib ]; then
    mkdir -p ${ftphome}/usr/lib
    fi
    if [ ! -d ${ftphome}/etc ]; then
    mkdir -p ${ftphome}/etc
    fi
    cp /usr/lib/ld.so /usr/lib/ld.so.1 ${ftphome}/usr/lib
    for lib in libc libdl libintl libw libnsl libsocket
    nss_nis nss_nisplus nss_dns nss_files
    do
    cp /usr/lib/${lib}.so.1 ${ftphome}/usr/lib
    rm -f ${ftphome}/usr/lib/${lib}.so
    ln -s ./${lib}.so.1 ${ftphome}/usr/lib/${lib}.so
    done
    图片 1

#!/bin/bash
#:Title:
#:Synopsis:
#:Data:
#:Version:1.0
#:Author:ro
#:Options:
#fdisk and fail the device
DISK(){                        //封装磁盘分区格式化的函数
read -p "choice a disk[/dev/sdb]:" CHOICE
NUM=`fdisk  -l | grep $CHOICE |wc -l &>/dev/null`
if [ "$NUM" -gt '0' ];then
  fdisk -l $CHOICE
  MOUNT=`mount -l | grep "^$CHOICE" &>/dev/null`
  MOUNTDISK=`echo $MOUNT`
    for I  in  $MOUNTDISK ;do
      if mount | grep "$I" &>/dev/null ;then
  mount | grep "$I"
      else
 echo "$I is not mounted."   
      fi
    done
fi
}
FAILDISK() {
    dd if=/dev/zero of=/dev/sdb bs=512 count=1
    sleep .1
    return 1
}
#create partions
CREATEDISK() {
echo '
n
p
1
+50M
n
p
2
+512M
n
p
3
+256M
t
3
82
w' | fdisk $CHOICE &>/dev/null
partprobe $CHOICE
sleep .1
mkfs.ext3  ${CHOICE}1 &>/dev/null
mkfs.ext3  ${CHOICE}2 &>/dev/null
mkswap -f   ${CHOICE}3 &>/dev/null
#mkfs
}
#mount the fdisk                //挂载磁盘分区
MOUNT(){
 if [ -d /mnt/$1 ];then
    if mount | grep "/mnt/$1";then
         umount /mnt/$1
  mount $CHOICE$2 /mnt/$1
  else
  mount $CHOICE$2 /mnt/$1
     fi
 else
 mkdir /mnt/$1
 mount $CHOICE$2 /mnt/$1
 fi
}
# make the root and make directories in sysboot //创建root目录和sysboot目录
ROOTFS(){                                   
cd /mnt/$1
mkdir {boot,proc,sys,dev,home,root,etc/{rc.d,sysconfig,init.d},bin,sbin,lib,usr/{bin,sbin,lib,include},var/{log,run},tmp,mnt,opt,media} -pv &>/dev/null    //创建基本的目录
chmod 777 tmp
#the script for  init 0  to shutdown the system
cd /mnt/$1/etc/rc.d
touch shutdown.sh
cat >>shutdown.sh<<EOF
#!/bin/bash
sync
sleep 2
sync
sync
umount /dev/sda1
umount /dev/sda2
exec /sbin/halt -p
EOF
chmod +x shutdown.sh
#the /sysroot/etc/inittab file and creat it
touch /mnt/$1/etc/inittab
cd /mnt/$1/etc
cat >>inittab<<EOF
#default level.
id:3:initdefault:
#--->rc.sysinit.
si::sysinit:/etc/rc.d/rc.sysinit     
#----->init 0 to shutdown.
l0:0:wait:/etc/rc.d/shutdown.sh
#----->single user mode.
l1:1:wait:/sbin/init -t1 S
#----->the terminals of the minilinux
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
EOF
#cp the INTERNET CARD module to the minilinux
cd /mnt/$1/lib
mkdir  -p modules
cd modules
cp /lib/modules/2.6.18-164.el5/kernel/drivers/net/mii.ko ./
cp /lib/modules/2.6.18-164.el5/kernel/drivers/net/pcnet32.ko   ./
#the /etc/sysctl.conf file
cd /mnt/$1/etc
touch  sysctl.conf
cat >>sysctl.conf<<EOF
net.ipv4.ip_forward = 0
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
EOF
#the /etc/rc.d/rc.sysinit file
cd /mnt/$1/etc/rc.d
touch rc.sysinit
cat >>rc.sysinit<<EOF
#!/bin/bash
echo -e "ttWelcome to 33[31;1mLittle33[0m Linux..."
##the network modules an set IP address to the minilinux##
if [[ -x /sbin/sysctl && -r /etc/syctl.conf ]];then
 echo $"configuring kernel paremeters"
 /sbin/sysctl -p /etc/sysctl.conf
 echo $"....kernel parameters done."
 fi
[ -e /lib/modules/mii.ko ] && /sbin/insmod /lib/modules/mii.ko
[ -e /lib/modules/pcnet32.ko ] && /sbin/insmod /lib/modules/pcnet32.ko
 echo "load the eth cart drivers ok.."
 echo "set ip "
 /sbin/ifconfig lo 127.0.0.1/8
 /sbin/ifconfig eth0 192.168.0.133/24
##the network modules an set IP address to the minilinux##
###########The hostname for the minilinux
[ -f /etc/sysconfig/network ] && source /etc/sysconfig/network
[ -z $HOSTNAME ] && HOSTNAME=RoQi
echo $HOSTNAME > /proc/sys/kernel/hostname
##########hostname for the systerm
mount -n -o remount,rw /
mount -n -a
EOF
chmod +x rc.sysinit
#the fstab file
cd /mnt/$1/etc/
touch fstab
echo "/dev/sda2      /         ext3    defaults        0 0" >fstab
echo "/dev/sda1      /boot     ext3    defaults        0 0" >>fstab
echo "sysfs          /sys      sysfs   defaults        0 0" >>fstab
echo "proc           /proc     proc    defaults        0 0" >>fstab
#the issue file to show the login infomation
cd /mnt/$1/etc/
touch issue
cat >>issue<<EOF
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel r on an m
 *************************
*welcome to Ro's minilinux*
*login:root;passwd: RedHat*
 *************************
EOF
##the /proc/sys/kernel file
mkdir -p /mnt/sysroot/proc/sys/kernel/
touch hostname
cat >>hostname<<EOF
Ro.minilinux.org
EOF
#the yum.conf files
mkdir -p  /mnt/$1/etc/yum.repos.d/
touch yum.repo
cat >>yum.repo<<EOF
[base]
name=Instructor Server Repository
baseurl=ftp://192.168.0.254/pub/Server
gpgcheck=0
[VT]
name=Instructor VT Repository
baseurl=ftp://192.168.0.254/pub/VT
gpgcheck=0
[Cluster]
name=Instructor Cluster Repository
baseurl=ftp://192.168.0.254/pub/Cluster
gpgcheck=0
[ClusterStorage]
name=Instructor ClusterStorage Repository
baseurl=ftp://192.168.0.254/pub/ClusterStorage
gpgcheck=0
EOF
cd  /mnt/$1/root/
touch .bash_profile
echo "PS1='[u@h W]$'">.bash_profile
}
#this function use to cp files from normal machine to the minilinux
CPLIB(){
#cp the "login" file
cp /tmp/myscript/login /mnt/sysroot/bin
chmod +x /mnt/sysroot/bin/login
#CP libnss files
 cp /usr/lib/libnss3.so /mnt/sysroot/usr/lib/
 cp /usr/lib/libnssckbi.so /mnt/sysroot/usr/lib/
 cp /usr/lib/libnssutil3.so  /mnt/sysroot/usr/bin/
 cp -d /usr/lib/libnss_files.so /mnt/sysroot/usr/lib/
 cp -d /usr/lib/libnss_compat.so /mnt/sysroot/usr/lib/
 cp -d  /lib/libnss_files* /mnt/sysroot/lib/
 cp -d  /lib/libnss_compat* /mnt/sysroot/lib/
#cp login files
cp -d /lib/libcrypt.so.1 /mnt/sysroot/lib/
cp -d /lib/libcrypt-2.5.so /mnt/sysroot/lib/
cp  /lib/libm.so.6 /mnt/sysroot/lib/
#cp -d /lib/libcrypt-2.5.so /mnt/sysroot/lib/
#cp user and passwd files
cp /etc/passwd /mnt/sysroot/etc/
cp /etc/shadow /mnt/sysroot/etc/
cp /etc/group /mnt/sysroot/etc/
cp /etc/gshadow /mnt/sysroot/etc/
#cp nsswitch.conf file
cp /etc/nsswitch.conf   /mnt/sysroot/etc/
}
#the script use to cp the /bin to /mnt/sysroot/bin
BINCP(){
  if which $1 &>/dev/null;then
    DR=`which $1 | grep -o "/.*" | sed -n 's/(.*)/.*/1/p'`
    FR=`which $1 | grep -o "/.*"`
      [ -d ${2}$DR ] || mkdir -pv ${2}$DR &> /dev/null
      [ -e ${2}$FR ]|| cp $FR ${2}$DR
      LIB=`ldd $FR | sed -n 's/.*/lib/(.*)/1/gp' | awk '{print $1}'`
      for I in $LIB;do
 LDR=`ldd $FR | grep -o '/.*' | awk '{print $1}' | sed -n 's@(/.*)/'"$I"'@1@gp'`
 [ -d ${2}$LDR ] || mkdir -pv ${2}$LDR &> /dev/null
 [ ! -e ${2}"$LDR"/"$LIB" ] && cp -f "$LDR"/"$I" ${2}$LDR
      done
  else
 echo "$1 is not exit."
  fi
}
#change the  initrd. file
INIT(){
TMPDIR=`mktemp -d /tmp/little.XX`
cd $TMPDIR
zcat /boot/initrd-2.6.18-164.el5.img | cpio -id
  sed -i 's/echo Scanning and configuring dmraid supported devices/#&/g' $TMPDIR/init
  sed -i 's/echo Scanning logical volumes/#&/g' $TMPDIR/init
  sed -i 's/lvm vgscan --ignorelockingfailure/#&/g'  $TMPDIR/init
  sed -i 's/echo Activating logical volumes/#&/g'  $TMPDIR/init
  sed -i 's/lvm vgchange -ay --ignorelockingfailure  vol0/#&/g'  $TMPDIR/init
  sed -i 's/resume LABEL=SWAP-sda3/#&/g'  $TMPDIR/init
  sed -i 's@mkrootdev -t ext3 -o defaults,ro /dev/vol0/root/@mkrootdev -t ext3 -o defaults,ro  sda2@g'  $TMPDIR/init
  find . | cpio -H newc -o --quiet | gzip -9 > $1/initrd.gz
#  cp /boot/vmlinuz-2.6.18-164.el5 $1/vmlinuz
  cp /boot/vmlinuz-2.6.28.10-myminilinux  /mnt/boot/vmlinuz-2.6.28.10-myminilinux
}
###the grub file
GRUB(){
# install grub
grub-install --root-directory=/mnt $CHOICE &>/dev/null
#the context of grub file
cd /mnt/boot/grub
touch grub.conf
cat >>grub.conf<<EOF
default=0
timeout=10
 title Welcome to Ro_Qi  minilinux
 root (hd0,0)
 kernel /vmlinuz-2.6.28.10-myminilinux  ro root=/dev/sda2
 initrd /initrd.gz
EOF
}
#the main function
HELPWORD(){
  echo "./mknewlinux.sh -a:make a new linux."
  echo "./mknewlinux.sh -d DEVICE_NAME:make a new fdisk."
  echo "./mknewlinux.sh -m:mount the filesystem."
  echo "./mknewlinux.sh -r:Initialize the rootfs."
  echo "./mknewlinux.sh -b:copy the lib and command."
  echo "./mknewlinux.sh -k:edit the interd file."
  echo "./mknewlinux.sh -g:make grub.conf."
  echo "./mknewlinux.sh -h:help files."
}
while getopts "ad:mrbkgh" OPTS;do
  case $OPTS in
    a)
 DISK
 FAILDISK
 CREATEDISK
 MOUNT boot 1
 MOUNT sysroot 2
 ROOTFS sysroot
 CPLIB
 for I in ls ifconfig ping vim  useradd userdel usermod  yum  lsmod modprobe touch insmod mkdir mingetty hostname mv rm vi runlevel sync halt chmod swapoff swapon sysctl umount cp cat init bash ;do
   BINCP $I /mnt/sysroot
 done
 ln -sv bash sh &>/dev/null
 INIT /mnt/boot
 rm -rf $TMPDIR
 GRUB
 sync
 sync
 sleep 2
    ;;
    d)
 DISK $OPTARG
 FAILDISK $OPTARG
 CREATEDISK $OPTARG
    ;;
    m)
 MOUNT boot 1
 MOUNT sysroot 2
    ;;
    r)
 ROOTFS sysroot
    ;;
    b)
 
 CPLIB
 for I in pwd  ls ifconfig ping useradd userdel usermod  yum  lsmod modprobe touch insmod mkdir mingetty hostname mv rm vi runlevel sync halt chmod swapoff swapon sysctl umount cp cat init bash ;do
   BINCP $I /mnt/sysroot
 done
 ln -sv bash sh &>/dev/null
    ;;
    k)
 NIT /mnt/boot
 rm -rf $TMPDIR
    ;;
    g)
 GRUB
 sync
 sync
 sleep 2
    ;;
    h)
 HELPWORD
    ;;
    *)
 HELPWORD
    ;;
  esac
done
#cp -d /lib/libcrypt-2.5.so /mnt/sysroot/lib/
#ln -s bash sh

Centos6.4安装配置LNMP

配置环境:
L:Centos 2.6.32-358.el6.x86_64
N:Nginx 1.7
M:Mysql5.7.3
P:PHP5.5.11
NGINX一键脚本:

#!/bin/bash
# Author:Byrd
# Version:1.0
# Site:www.t4x.org
# Contact:root#t4x.org
# Compile and install NGINX BY:BYRD AT:2014-04-30
# This script for nginx1.4 nginx1.6 nginx1.7

# Define
DownTools=/byrd/tools
NginxWget=
Openssl=
NginxVersion=nginx-1.7.4
InstallNginxDir=/byrd/service
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG="en_US.UTF-8"
# Check if user is root
if [ $UID != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
clear
echo "========================================================================="
echo "============================Install Nginx================================"
echo "========================================================================="
echo "=============================www.t4x.org================================="
echo "========================================================================="
# Create web user
groupadd www
useradd -s /sbin/nologin -g www www
yum install pcre* openssl* openssl-devel gcc gcc-c++ wget vim -y
# Create a file download directory
[ ! -d $DownTools ] && mkdir -p $DownTools
[ ! -d $InstallNginxDir ] && mkdir $InstallNginxDir
cd $InstallNginxDir
if [ ! -f openssl-1.0.1h.tar.gz ];then
wget $Openssl || exit 1 && echo "Please changes Openssl URL"
tar zxf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config
make
else
tar zxf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config
make
fi
RETVAL1=$?
if [ $RETVAL1 -eq 0 ];then
echo "Openssl installed successfully"
else
exit $RETVAL1
fi
cd $DownTools
wget $NginxWget
tar zxf $NginxVersion.tar.gz
cd $NginxVersion
./configure --user=www --group=www --prefix=$InstallNginxDir/$NginxVersion --with-openssl=$InstallNginxDir/openssl-1.0.1h --with-pcre --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-ipv6 --with-http_sub_module &&
#./configure --user=www --group=www --prefix=/byrd/service/nginx-1.6.2 --with-openssl=/byrd/service/openssl-1.0.1j --with-pcre --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module
make && make install
RETVAL2=$?
if [ $RETVAL2 -eq 0 ];then
echo "Nginx installed successfully"
else
exit $RETVAL2
fi
ln -s $InstallNginxDir/$NginxVersion /usr/local/nginx
/usr/local/nginx/sbin/nginx
/bin/netstat -tunlp | /bin/grep 80
if [ -s /sbin/iptables ]; then
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables-save
fi

Mysql一键安装:

#!/bin/bash
# Author:Byrd
# Version:1.0
# Site:www.t4x.org
# Contact:root#t4x.org
# This script for Mysql 5.6.16
# Check if user is root
if [ $UID != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
clear
echo "========================================================================="
echo "Will automatically install mysql"
echo "========================================================================="
MysqlInstall=/byrd/service
DownMysqlTools=/byrd/tools
MysqlUrl=
Version=mysql-5.6.19
[ ! -d $DownMysqlTools ] && mkdir -p $DownMysqlTools
[ ! -d $MysqlInstall ] && mkdir $MysqlInstall
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
yum install pcre* openssl* openssl-devel gcc gcc-c++ cmake libaio* library* ncurses-* -y
cd $DownMysqlTools
if [ ! -f $Version.tar.gz ];then
wget $MysqlUrl
tar zxf $Version.tar.gz
cd $Version
cmake . -DCMAKE_INSTALL_PREFIX=$MysqlInstall/$Version -DMYSQL_DATADIR=$MysqlInstall/$Version/data -DMYSQL_UNIX_ADDR=$MysqlInstall/$Version/tmp/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 &&
make && make install
RETVAL1=$?
elif [ -f $Version.tar.gz ];then
tar zxf $Version.tar.gz
cd $Version
cmake . -DCMAKE_INSTALL_PREFIX=$MysqlInstall/$Version -DMYSQL_DATADIR=$MysqlInstall/$Version/data -DMYSQL_UNIX_ADDR=$MysqlInstall/$Version/tmp/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 &&
make && make install
RETVAL1=$?
else
exit 1
fi
if [ $RETVAL1 -eq 0 ];then
echo "$Version install successful"
else
echo "$Version install failed."
fi
ln -s $MysqlInstall/$Version /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql
/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
/bin/mv /etc/my.cnf /etc/my.cnf.backup
/bin/cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
/etc/init.d/mysqld start
if [ `netstat -tunlp | grep mysql |wc -l` -ne 0 ];then
echo "$Version Starting successful"
else
echo "$Version Starting failed."
fi

PHP一键脚本:

#!/bin/bash
# Author:Byrd
# Version:1.0
# Site:www.t4x.org
# Contact:root#t4x.org
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG="en_US.UTF-8"
# Check if user is root
if [ $UID != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
clear
echo "========================================================================="
echo "Install PHP5.5.11 BY:BYRD AT:2014-04-30"
echo "========================================================================="
RETVAL=0
SoftTool=/byrd/tools
Server=/byrd/server
LibiconvUrl=
LibicoVern=libiconv-1.9.2
[ ! -d $SoftTool ] && mkdir -p $SoftTool
[ ! -d $Server ] && mkdir $Server
yum install zlib libjpeg freetype libpng gd curl zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel gcc gcc-c++ wget libxml* libtool* libxslt* -y
cd $SoftTool
if [ ! -f $LibicoVern.tar.gz ];then
wget $LibiconvUrl || exit 1 && echo "$LibicoVern Download Error,Please try again"
tar zxf $LibicoVern.tar.gz
cd $LibicoVern
./configure --prefix=/usr/local/libiconv
make && make install
RETVAL1=$?
elif [ -f $LibicoVern.tar.gz ];then
tar zxf $LibicoVern.tar.gz
cd $LibicoVern
./configure --prefix=/usr/local/libiconv
make && make install
RETVAL1=$?
else
exit 1
fi
if [ `echo $RETVAL1` -eq $RETVAL ];then
echo "$LibicoVern Install Successful"
else
echo "$LibicoVern Install Failured"
exit `echo $RETVAL1`
fi
libmcryptUrl=
libmcryptVen=libmcrypt-2.5.8
cd $SoftTool
if [ ! -f $libmcryptVen.tar.gz ];then
wget $libmcryptUrl || exit 1 && echo "$libmcryptVen.tar.gz Download Error,Please try again"
tar zxf $libmcryptVen.tar.gz
cd $libmcryptVen
./configure
make && make install
RETVAL2=$?
rm -f /usr/lib/libmcrypt.*
rm -f /usr/lib/libmhash*
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
rm -f /usr/lib64/libmcrypt.*
rm -f /usr/lib64/libmhash*
ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
ldconfig -v
elif [ -f $libmcryptVen.tar.gz ];then
tar zxf $libmcryptVen.tar.gz
cd $libmcryptVen
./configure
make && make install
rm -f /usr/lib/libmcrypt.*
rm -f /usr/lib/libmhash*
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
rm -f /usr/lib64/libmcrypt.*
rm -f /usr/lib64/libmhash*
ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
ldconfig -v
else
exit 1
fi
if [ `echo $RETVAL2` -eq $RETVAL ];then
echo "$libmcryptVen Install Successful"
else
echo "$libmcryptVen Install Failured"
exit `echo $RETVAL2`
fi
cd $SoftTool
mhashUrl=
mhashDev=mhash-0.9.9.9
if [ ! -f $mhashDev.tar.gz ];then
wget $mhashUrl
tar zxf $mhashDev.tar.gz
cd $mhashDev
./configure
make && make install
RETVAL3=$?
else
tar zxf $mhashDev.tar.gz
cd $mhashDev
./configure
make && make install
RETVAL3=$?
fi
if [ `echo $RETVAL3` -eq $RETVAL ];then
echo "$mhashDev Install Successful"
else
echo "$mhashDev Install Failured"
exit `echo $RETVAL3`
fi
cd $SoftTool
PhpUrl=
PhpVen=php-5.5.11
if [ ! -f $PhpVen.tar.gz ];then
wget $PhpUrl
tar zxf $PhpVen.tar.gz
cd $PhpVen
./configure --enable-opcache --prefix=$Server/$PhpVen --with-mysql=/usr/local/mysql/ --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp
make && make install
RETVAL4=$?
else
tar zxf $PhpVen.tar.gz
cd $PhpVen
./configure --enable-opcache --prefix=$Server/$PhpVen --with-mysql=/usr/local/mysql/ --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp
make && make install
RETVAL4=$?
fi
if [ `echo $RETVAL4` -eq $RETVAL ];then
echo "$PhpVen Install Successful"
else
echo "$PhpVen Install Failured"
exit `echo $RETVAL4`
fi
ln -s $Server/$PhpVen /usr/local/php
cp $SoftTool/$PhpVen/php.ini-production /usr/local/php/lib/php.ini
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
/usr/local/php/sbin/php-fpm -t
/usr/local/php/sbin/php-fpm
if [ `netstat -tunlp | grep php-fpm |wc -l` -ne 0 ];then
echo "$PhpVen Starting successful"
else
echo "$PhpVen Starting failed."
fi

PHP参数设置:

./configure --enable-opcache --prefix=/Byrd/service/php-5.5.11 --with-mysql=/usr/local/mysql/ --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=bywww --with-fpm-group=bywww --enable-ftp --disable-fileinfo --with-pdo-mysql

基于Centos6.4 X64、PHP5.5.11、NGINX1.7、MYSQL5.7.3

配置环境: L:Centos 2.6.32-358.el6.x86_64 N:Nginx 1.7 M:Mysql5.7.3 P:PHP5.5.11 NGINX一键脚本: #!/bin/bash # Author:Byrd # Version:1.0 # Site:ww...

echo "make failed ,please check it out!"

如何在UNIX平台建立FTP服务器
目前很多企业单位正在构架自己的Intranet,FTP服务器是其中的一个服务支持,有很多单位购置了基于UNIX平台的计算机,为了在网上能够提供FTP服务支持,专门购置基于UNIX平台的FTP Server软件,其实在基于UNIX平台的计算机系统中,采取一定的技术方法,就可以建立自己的FTP Server,实现网上文件上下载服务,无须再购置专门的软件,和乐而不为之呢?如何在UNIX平台建立FTP服务器?下面就其建立过程阐述如下:

自动创建一个小于10M的Linux系统,脚本使用说明:需要在宿主机上装两个硬盘,在测试的时候,只需要把第二块硬盘放到新的虚拟机中,然后启动就行了。

tar -xvf mysql-5.5.46.tar.gz

图片 2

chown -R mysql.mysql /data/mysql/

fi

chgrp -R mysql /usr/local/mysql/

echo "-------------------------configuring mysql,please wait-----------------"

ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk

chmod 755 /etc/init.d/mysql

echo "make mysql, please wait for 20 minutes"

groupadd mysql

else

ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe

yum install -y ncurses gcc gcc-c++ ncurses ncurses-devel openssl openssl-devel libtool* cmake

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

-DMYSQL_DATADIR=/var/mysql/data

echo "mysql start filed ,please check it out!"

#chkconfig --level 2345 mysqld on

-DWITH_READLINE=1

make

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk

mkdir -p /data/mysql

if [ 'grep "mysql" /etc/passwd | wc -l' ]; then

if [ $? -ne 0 ];then

if [ -s /etc/my.cnf ];then

-DDEFAULT_COLLATION=utf8_general_ci

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

-DWITH_MYISAM_STORAGE_ENGINE=1

cd mysql-5.5.46

-DDEFAULT_CHARSET=utf8

echo "mysql starting"

ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump

rm -rf /etc/my.cnf

else

fi

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql

#chkconfig --add mysqld

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

exit 1

echo "-------------------------------downloading mysql----------------------------------"

echo "------------------------------unpackaging mysql -----------------------------------"

-DWITH_MEMORY_STORAGE_ENGINE=1

if [ $? -ne 0 ];then

echo "mysql user exists"

echo "adding user mysql"

-DENABLED_LOCAL_INFILE=1

echo "configure failed ,please check it out!"

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

-DMYSQL_USER=mysql

fi

fi

sed -i 's#^thread_concurrency = 8#& ndatadir = /data/mysql#g' /etc/my.cnf

useradd -s /sbin/nologin -M -g mysql mysql

exit 1

cp -f ./support-files/my-large.cnf /etc/my.cnf

/usr/local/mysql/bin/mysqld --user=mysql

wget

#chown -R mysql /usr/local/mysql/var

#!/bin/sh

fi

echo "----------------------------------start install mysql -----------------------------"

-DWITH_INNOBASE_STORAGE_ENGINE=1

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

make install

if [ $? -ne 0 ];then

chown -R mysql:mysql /usr/local/mysql

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock

echo "mysql start successful,congratulations!"

本文由美高梅网址发布于计算机网络,转载请注明出处:脚本自动创建一个小于10M的Linux系统,Mysql安装脚

上一篇:每次落地后反跳回原高度的一半,求小球的高度 下一篇:没有了
猜你喜欢
热门排行
精彩图文