I wrote this little bash script:
#!/bin/bash
apt-get update
apt-get upgrade
apt-get install apache2
apt-get install php5
apt-get install mysql-server
apt-get install php5-mysql
service apache2 restart
apt-get update
apt-get install python-software-properties
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php5-5.6
apt-get update
apt-get upgrade
apt-get install php5
apt-get install vsftpd
apt-get install php5-curl
in order to create lamp and install php 5.6 on ubuntu 14.04
Everything works just fine, but I need to type "y" when prompted for and one time I need to hit enter (at this line:
add-apt-repository ppa:ondrej/php5-5.6
)
The script executes without typing "y" when running it with
yes | ./script.sh
but at the point I need to hit enter, it just gives me an output of numerous "y" and breaks. After running the script those files:
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/
are locked and I need to unlock them again, in order to install further stuff.
Is there a way to get this running properly? Without a lock of files and just doing what it is supposed to do...
You can change each apt-get install
to apt-get -y install
and change add-apt-repository
to add-apt-repository -y
to assume yes for all questions.