mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Updated installer
This commit is contained in:
parent
fe00b0e401
commit
bd334076ca
56
snipeit.sh
56
snipeit.sh
|
@ -157,15 +157,15 @@ case $distro in
|
||||||
sudo apt-get -y install apache2 >> /var/log/snipeit-install.log 2>&1
|
sudo apt-get -y install apache2 >> /var/log/snipeit-install.log 2>&1
|
||||||
sudo apt-get install -y git unzip php5 php5-mcrypt php5-curl php5-mysql php5-gd php5-ldap libapache2-mod-php5 curl >> /var/log/snipeit-install.log 2>&1
|
sudo apt-get install -y git unzip php5 php5-mcrypt php5-curl php5-mysql php5-gd php5-ldap libapache2-mod-php5 curl >> /var/log/snipeit-install.log 2>&1
|
||||||
sudo service apache2 restart
|
sudo service apache2 restart
|
||||||
|
|
||||||
#We already established MySQL root & user PWs, so we dont need to be prompted. Let's go ahead and install Apache, PHP and MySQL.
|
#We already established MySQL root & user PWs, so we dont need to be prompted. Let's go ahead and install Apache, PHP and MySQL.
|
||||||
echo "## Setting up LAMP."
|
echo "## Setting up LAMP."
|
||||||
#sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lamp-server^ >> /var/log/snipeit-install.log 2>&1
|
#sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lamp-server^ >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
# Get files and extract to web dir
|
# Get files and extract to web dir
|
||||||
echo ""
|
echo ""
|
||||||
echo "## Downloading snipeit and extract to web directory."
|
echo "## Downloading snipeit and extract to web directory."
|
||||||
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
||||||
unzip -qo $tmp/$file -d $tmp/
|
unzip -qo $tmp/$file -d $tmp/
|
||||||
cp -R $tmp/snipe-it-master $webdir/$name
|
cp -R $tmp/snipe-it-master $webdir/$name
|
||||||
|
|
||||||
|
@ -173,9 +173,9 @@ case $distro in
|
||||||
|
|
||||||
#Enable mcrypt and rewrite
|
#Enable mcrypt and rewrite
|
||||||
echo "## Enabling mcrypt and rewrite"
|
echo "## Enabling mcrypt and rewrite"
|
||||||
sudo php5enmod mcrypt >> /var/log/snipeit-install.log 2>&1
|
sudo php5enmod mcrypt >> /var/log/snipeit-install.log 2>&1
|
||||||
sudo a2enmod rewrite >> /var/log/snipeit-install.log 2>&1
|
sudo a2enmod rewrite >> /var/log/snipeit-install.log 2>&1
|
||||||
sudo ls -al /etc/apache2/mods-enabled/rewrite.load >> /var/log/snipeit-install.log 2>&1
|
sudo ls -al /etc/apache2/mods-enabled/rewrite.load >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
#Create a new virtual host for Apache.
|
#Create a new virtual host for Apache.
|
||||||
echo "## Create Virtual host for apache."
|
echo "## Create Virtual host for apache."
|
||||||
|
@ -195,7 +195,7 @@ case $distro in
|
||||||
|
|
||||||
echo "## Setting up hosts file."
|
echo "## Setting up hosts file."
|
||||||
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
||||||
a2ensite $name.conf >> /var/log/snipeit-install.log 2>&1
|
a2ensite $name.conf >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
#Modify the Snipe-It files necessary for a production environment.
|
#Modify the Snipe-It files necessary for a production environment.
|
||||||
echo "## Modify the Snipe-It files necessary for a production environment."
|
echo "## Modify the Snipe-It files necessary for a production environment."
|
||||||
|
@ -231,12 +231,12 @@ case $distro in
|
||||||
sudo chmod -R 755 $webdir/$name/public/uploads
|
sudo chmod -R 755 $webdir/$name/public/uploads
|
||||||
sudo chown -R www-data:www-data /var/www/
|
sudo chown -R www-data:www-data /var/www/
|
||||||
# echo "## Finished permission changes."
|
# echo "## Finished permission changes."
|
||||||
|
|
||||||
echo "## Input your MySQL/MariaDB root password: "
|
echo "## Input your MySQL/MariaDB root password: "
|
||||||
echo ""
|
echo ""
|
||||||
sudo mysql -u root -p < $dbsetup
|
sudo mysql -u root -p < $dbsetup
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "## Securing Mysql"
|
echo "## Securing Mysql"
|
||||||
echo "## I understand this is redundant. You don't need to change your root pw again if you don't want to."
|
echo "## I understand this is redundant. You don't need to change your root pw again if you don't want to."
|
||||||
# Have user set own root password when securing install
|
# Have user set own root password when securing install
|
||||||
|
@ -254,7 +254,7 @@ case $distro in
|
||||||
echo "## Restarting apache."
|
echo "## Restarting apache."
|
||||||
service apache2 restart
|
service apache2 restart
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu)
|
ubuntu)
|
||||||
##################################### Install for Ubuntu ##############################################
|
##################################### Install for Ubuntu ##############################################
|
||||||
|
|
||||||
|
@ -269,15 +269,15 @@ case $distro in
|
||||||
sudo apt-get -y upgrade >> /var/log/snipeit-install.log 2>&1
|
sudo apt-get -y upgrade >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
echo "## Installing packages."
|
echo "## Installing packages."
|
||||||
sudo apt-get install -y git unzip php5 php5-mcrypt php5-curl php5-mysql php5-gd php5-ldap >> /var/log/snipeit-install.log 2>&1
|
sudo apt-get install -y git unzip php5 php5-mcrypt php5-curl php5-mysql php5-gd php5-ldap >> /var/log/snipeit-install.log 2>&1
|
||||||
#We already established MySQL root & user PWs, so we dont need to be prompted. Let's go ahead and install Apache, PHP and MySQL.
|
#We already established MySQL root & user PWs, so we dont need to be prompted. Let's go ahead and install Apache, PHP and MySQL.
|
||||||
echo "## Setting up LAMP."
|
echo "## Setting up LAMP."
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lamp-server^ >> /var/log/snipeit-install.log 2>&1
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lamp-server^ >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
# Get files and extract to web dir
|
# Get files and extract to web dir
|
||||||
echo ""
|
echo ""
|
||||||
echo "## Downloading snipeit and extract to web directory."
|
echo "## Downloading snipeit and extract to web directory."
|
||||||
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
||||||
unzip -qo $tmp/$file -d $tmp/
|
unzip -qo $tmp/$file -d $tmp/
|
||||||
cp -R $tmp/snipe-it-master $webdir/$name
|
cp -R $tmp/snipe-it-master $webdir/$name
|
||||||
|
|
||||||
|
@ -285,9 +285,9 @@ case $distro in
|
||||||
|
|
||||||
#Enable mcrypt and rewrite
|
#Enable mcrypt and rewrite
|
||||||
echo "## Enabling mcrypt and rewrite"
|
echo "## Enabling mcrypt and rewrite"
|
||||||
sudo php5enmod mcrypt >> /var/log/snipeit-install.log 2>&1
|
sudo php5enmod mcrypt >> /var/log/snipeit-install.log 2>&1
|
||||||
sudo a2enmod rewrite >> /var/log/snipeit-install.log 2>&1
|
sudo a2enmod rewrite >> /var/log/snipeit-install.log 2>&1
|
||||||
sudo ls -al /etc/apache2/mods-enabled/rewrite.load >> /var/log/snipeit-install.log 2>&1
|
sudo ls -al /etc/apache2/mods-enabled/rewrite.load >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
#Create a new virtual host for Apache.
|
#Create a new virtual host for Apache.
|
||||||
echo "## Create Virtual host for apache."
|
echo "## Create Virtual host for apache."
|
||||||
|
@ -307,7 +307,7 @@ case $distro in
|
||||||
|
|
||||||
echo "## Setting up hosts file."
|
echo "## Setting up hosts file."
|
||||||
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
||||||
a2ensite $name.conf >> /var/log/snipeit-install.log 2>&1
|
a2ensite $name.conf >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
#Modify the Snipe-It files necessary for a production environment.
|
#Modify the Snipe-It files necessary for a production environment.
|
||||||
echo "## Modify the Snipe-It files necessary for a production environment."
|
echo "## Modify the Snipe-It files necessary for a production environment."
|
||||||
|
@ -383,9 +383,9 @@ case $distro in
|
||||||
echo >> $mariadbRepo "gpgcheck=1"
|
echo >> $mariadbRepo "gpgcheck=1"
|
||||||
echo >> $mariadbRepo "enable=1"
|
echo >> $mariadbRepo "enable=1"
|
||||||
|
|
||||||
yum -y install wget epel-release >> /var/log/snipeit-install.log 2>&1
|
yum -y install wget epel-release >> /var/log/snipeit-install.log 2>&1
|
||||||
wget -P $tmp/ https://centos6.iuscommunity.org/ius-release.rpm >> /var/log/snipeit-install.log 2>&1
|
wget -P $tmp/ https://centos6.iuscommunity.org/ius-release.rpm >> /var/log/snipeit-install.log 2>&1
|
||||||
rpm -Uvh $tmp/ius-release*.rpm >> /var/log/snipeit-install.log 2>&1
|
rpm -Uvh $tmp/ius-release*.rpm >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
|
|
||||||
#Install PHP and other needed stuff.
|
#Install PHP and other needed stuff.
|
||||||
|
@ -397,7 +397,7 @@ case $distro in
|
||||||
echo " ##" $p "Installed"
|
echo " ##" $p "Installed"
|
||||||
else
|
else
|
||||||
echo -n " ##" $p "Installing... "
|
echo -n " ##" $p "Installing... "
|
||||||
yum -y install $p >> /var/log/snipeit-install.log 2>&1
|
yum -y install $p >> /var/log/snipeit-install.log 2>&1
|
||||||
echo "";
|
echo "";
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
|
@ -405,7 +405,7 @@ case $distro in
|
||||||
echo ""
|
echo ""
|
||||||
echo "## Downloading Snipe-IT from github and putting it in the web directory.";
|
echo "## Downloading Snipe-IT from github and putting it in the web directory.";
|
||||||
|
|
||||||
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
||||||
unzip -qo $tmp/$file -d $tmp/
|
unzip -qo $tmp/$file -d $tmp/
|
||||||
cp -R $tmp/snipe-it-master $webdir/$name
|
cp -R $tmp/snipe-it-master $webdir/$name
|
||||||
|
|
||||||
|
@ -507,9 +507,9 @@ case $distro in
|
||||||
#Allow us to get the mysql engine
|
#Allow us to get the mysql engine
|
||||||
echo ""
|
echo ""
|
||||||
echo "## Add IUS, epel-release and mariaDB repos.";
|
echo "## Add IUS, epel-release and mariaDB repos.";
|
||||||
yum -y install wget epel-release >> /var/log/snipeit-install.log 2>&1
|
yum -y install wget epel-release >> /var/log/snipeit-install.log 2>&1
|
||||||
wget -P $tmp/ https://centos7.iuscommunity.org/ius-release.rpm >> /var/log/snipeit-install.log 2>&1
|
wget -P $tmp/ https://centos7.iuscommunity.org/ius-release.rpm >> /var/log/snipeit-install.log 2>&1
|
||||||
rpm -Uvh $tmp/ius-release*.rpm >> /var/log/snipeit-install.log 2>&1
|
rpm -Uvh $tmp/ius-release*.rpm >> /var/log/snipeit-install.log 2>&1
|
||||||
|
|
||||||
#Install PHP and other needed stuff.
|
#Install PHP and other needed stuff.
|
||||||
echo "## Installing PHP and other needed stuff";
|
echo "## Installing PHP and other needed stuff";
|
||||||
|
@ -520,7 +520,7 @@ case $distro in
|
||||||
echo " ##" $p "Installed"
|
echo " ##" $p "Installed"
|
||||||
else
|
else
|
||||||
echo -n " ##" $p "Installing... "
|
echo -n " ##" $p "Installing... "
|
||||||
yum -y install $p >> /var/log/snipeit-install.log 2>&1
|
yum -y install $p >> /var/log/snipeit-install.log 2>&1
|
||||||
echo "";
|
echo "";
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
|
@ -528,7 +528,7 @@ case $distro in
|
||||||
echo ""
|
echo ""
|
||||||
echo "## Downloading Snipe-IT from github and put it in the web directory.";
|
echo "## Downloading Snipe-IT from github and put it in the web directory.";
|
||||||
|
|
||||||
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
wget -P $tmp/ https://github.com/snipe/snipe-it/archive/$file >> /var/log/snipeit-install.log 2>&1
|
||||||
unzip -qo $tmp/$file -d $tmp/
|
unzip -qo $tmp/$file -d $tmp/
|
||||||
cp -R $tmp/snipe-it-master $webdir/$name
|
cp -R $tmp/snipe-it-master $webdir/$name
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ case $distro in
|
||||||
#Modify the Snipe-It files necessary for a production environment.
|
#Modify the Snipe-It files necessary for a production environment.
|
||||||
echo "## Modifying the Snipe-IT files necessary for a production environment."
|
echo "## Modifying the Snipe-IT files necessary for a production environment."
|
||||||
echo " Setting up Timezone."
|
echo " Setting up Timezone."
|
||||||
tzone=$(timedatectl | gawk -F'[: ]+' ' $2 ~ /Timezone/ {print $3}');
|
tzone=$(timedatectl | gawk -F'[: ]' ' $9 ~ /zone/ {print $11}');
|
||||||
sed -i "s,UTC,$tzone,g" $webdir/$name/app/config/app.php
|
sed -i "s,UTC,$tzone,g" $webdir/$name/app/config/app.php
|
||||||
|
|
||||||
echo " Setting up bootstrap file."
|
echo " Setting up bootstrap file."
|
||||||
|
|
Loading…
Reference in a new issue