This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
20_centos_yum.sh
executable file
·120 lines (106 loc) · 3.22 KB
/
20_centos_yum.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# CentOS-only stuff. Abort if not CentOS.
is_centos || return 1
# If the old files isn't removed, the duplicate YUM alias will break sudo!
sudoers_old="/etc/sudoers.d/sudoers-mode"; [[ -e "$sudoers_old" ]] && sudo rm "$sudoers_old"
# Installing this sudoers file makes life easier.
sudoers_file="sudoers-dotfiles"
sudoers_src=$DOTFILES/conf/centos/$sudoers_file
sudoers_dest="/etc/sudoers.d/$sudoers_file"
if [[ ! -e "$sudoers_dest" || "$sudoers_dest" -ot "$sudoers_src" ]]; then
cat <<EOF
The sudoers file can be updated to allow "sudo yum" to be executed
without asking for a password. You can verify that this worked correctly by
running "sudo yum". If it doesn't ask for a password, and the output
looks normal, it worked.
THIS SHOULD ONLY BE ATTEMPTED IF YOU ARE LOGGED IN AS ROOT IN ANOTHER SHELL.
This will be skipped if "Y" isn't pressed within the next $prompt_delay seconds.
EOF
read -N 1 -t $prompt_delay -p "Update sudoers file? [y/N] " update_sudoers; echo
if [[ "$update_sudoers" =~ [Yy] ]]; then
e_header "Updating sudoers"
visudo -cf "$sudoers_src" &&
sudo cp "$sudoers_src" "$sudoers_dest" &&
sudo chmod 0440 "$sudoers_dest" &&
echo "File $sudoers_dest updated." ||
echo "Error updating $sudoers_dest file."
else
echo "Skipping."
fi
fi
# Update YUM
e_header "Updating YUM"
sudo yum update -y -q
e_header "detecting if you're running 32 or 64-bit"
MACHINE_TYPE="$(uname -m)"
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
# 64-bit stuff here
dist="x86_64"
rpm_dist="x86_64"
echo "64 yeah boi"
else
# 32-bit stuff here
dist="i686"
rpm_dist="i386"
echo "32-biter"
fi
e_header "Installing Additional RPMs (Epel and iUS)"
sudo rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/${rpm_dist}/epel-release-6-5.noarch.rpm
sudo rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/${rpm_dist}/ius-release-1.0-11.ius.el6.noarch.rpm
sudo yum update -y -q
#remove old mysql libs if needed
if [ ! "$(rpm -qa | grep -P "mysql5.*u.*\.${dist}")" ]; then
e_header "removing mysql-libs from base image"
sudo yum remove mysql-libs -y
fi
# Install YUM packages.
packages=(
httpd
mysql56u-server
mysql56u-devel
php56u
php56u-mysql
php56u-gd
php56u-mcrypt
php56u-devel
php56u-mbstring
httpd-devel
gcc
php56u-pear
php56u-fpm
htop
tree
nginx
yum-plugin-replace
openssl-devel
readline-devel
zlib-devel
vim
wget
)
if (( ${#packages[@]} > 0 )); then
e_header "Installing YUM packages: ${packages[*]}"
for package in "${packages[@]}"; do
sudo yum -q -y install "$package"
done
fi
#update git
if [ ! "$(rpm -qa | grep -P "git2u.*\.centos6\.${dist}")" ]; then
e_header "Updating Git to v2.7"
sudo yum replace git --replace-with=git2u -y -q
fi
# Install Git Extras
if [[ ! "$(type -P git-extras)" ]]; then
e_header "Installing Git Extras"
(
cd $DOTFILES/vendor/git-extras &&
sudo make install
)
fi
#Phusion Passenger
sudo yum install -y epel-release pygpgme curl
# Add their el6 YUM repository
sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
# Install Passenger + Apache module
sudo yum install -y mod_passenger
# Install Passenger + Nginx
sudo yum install -y nginx passenger