-
Notifications
You must be signed in to change notification settings - Fork 37
/
mongoHomestead7.1.sh
executable file
·51 lines (38 loc) · 1.73 KB
/
mongoHomestead7.1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
echo "MongoDB install script with PHP7 & nginx [Laravel Homestead]"
echo "By Zakaria BenBakkar, @zakhttp, [email protected]"
echo "Importing the public key used by the package management system";
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927;
echo "Creating a list file for MongoDB.";
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list;
echo "Updating the packages list";
sudo apt-get update;
echo "Install the latest version of MongoDb";
sudo apt-get install -y mongodb-org;
echo "Fixing the pecl errors list";
sudo sed -i -e 's/-C -n -q/-C -q/g' `which pecl`;
echo "Installing OpenSSl Libraries";
sudo apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev;
sudo apt-get install -y libcurl4-openssl-dev pkg-config;
sudo apt-get install -y libsasl2-dev;
echo "Installing PHP7 mongoDb extension";
sudo pecl install mongodb;
echo "adding the extension to your php.ini file";
sudo touch /etc/php/7.1/mods-available/mongodb.ini
sudo echo "; configuration for php mongo module\n; priority=30\nextension=mongodb.so" >> /etc/php/7.1/mods-available/mongodb.ini
sudo ln -s /etc/php/7.1/mods-available/mongodb.ini 30-mongodb.ini
echo "Add mongodb.service file"
cat >/etc/systemd/system/mongodb.service <<EOL
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
EOL
sudo systemctl start mongodb
sudo systemctl status mongodb
sudo systemctl enable mongodb
echo "restarting The nginx server";
sudo service nginx restart && sudo service php7.1-fpm restart