I
I
Igor Pushkarsky2016-01-04 10:43:38
PHP
Igor Pushkarsky, 2016-01-04 10:43:38

How to install phpmyadmin from bootstrap.sh in vagrant?

In general, I’m trying to set up a vagrant file + ubuntu 15.04, with mysql I figured out how to feed the system passwords to him, but I don’t even understand with phpmyadmin. The installation reaches it and stupidly hangs.

#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive

sudo aptitude update -q

# Дополнительные фичи
sudo aptitude install -q -y -f mc

# Force a blank root password for mysql
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password rootpass'
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password rootpass'

sudo apt-get -y install mysql-server libapache2-mod-auth-mysql php5-mysql
#sudo aptitude install -q -y -f mysql-server mysql-client

sudo aptitude install -q -y -f nginx php5-fpm

# Install commonly used php packages
sudo aptitude install -q -y -f php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache

sudo rm /etc/nginx/sites-available/default
sudo touch /etc/nginx/sites-available/default

sudo cat >> /etc/nginx/sites-available/default <<'EOF'
server {
  listen   80;

  root /usr/share/nginx/html;
  index index.php index.html index.htm;

  # Make site accessible from http://localhost/
  server_name _;

  location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to index.html
    try_files $uri $uri/ /index.html;
  }

  location /doc/ {
    alias /usr/share/doc/;
    autoindex on;
    allow 127.0.0.1;
    deny all;
  }

  # redirect server error pages to the static page /50x.html
  #
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root /usr/share/nginx/html;
  }

  # pass the PHP scripts to FastCGI server listening on /tmp/php5-fpm.sock
  #
  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
  }

  # deny access to .htaccess files, if Apache's document root
  # concurs with nginx's one
  #
  location ~ /\.ht {
    deny all;
  }

  ### phpMyAdmin ###
  location /phpmyadmin {
    root /usr/share/;
    index index.php index.html index.htm;
    location ~ ^/phpmyadmin/(.+\.php)$ {
      client_max_body_size 4M;
      client_body_buffer_size 128k;
      try_files $uri =404;
      root /usr/share/;

      # Point it to the fpm socket;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi_params;
    }

    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)) {
      root /usr/share/;
    }
  }
  location /phpMyAdmin {
    rewrite ^/* /phpmyadmin last;
  }
  ### phpMyAdmin ###
}
EOF

sudo touch /usr/share/nginx/html/info.php

sudo cat >> /usr/share/nginx/html/info.php <<'EOF'
    <?php phpinfo(); ?>
EOF

#sudo aptitude install -q -y -f phpmyadmin

sudo service nginx restart

sudo service php5-fpm restart


I also want to move all the server and mysql config files to a separate directory and update the configs and databases with vagrant up.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2016-01-04
@OnYourLips

On what specific operation hangs up?
Besides, you have a lot of extra stuff. Why do you need, for example, location /doc/?
Or why sudo before every command? The default is privileged mode.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question