running virtual machines? - Page 3
Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35

Thread: running virtual machines?

  1. #31
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    2,232
    These are all the steps I took to get the VM completely working.
    VM
    1) Create VM - click new, set name, type and version; set memory (4096 MB); create dynamically allocated virtual disk

    2) Set setting of vm - click vm and choose settings;
    - go to network; adapter 1: NAT, connected; adapter 2: host-only, connected
    - go to Shared folders; add new, choose path to repositories, set name to repositories, check auto-mount

    3) start VM, "insert" centos minimal disk and install OS
    - create root password
    - create user
    - click reboot at end

    4) login, update and install packages
    - yum update
    - yum install gcc make kernel-devel bzip2

    5) install guest additions (I don't remember why I always do this, but I think it's something to do with the shared folders)
    - mkdir -p /media/cdrom
    - mount /dev/scd0 /media/cdrom
    - sh /media/cdrom/VBoxLinuxAdditions.run
    - unmount /media/cdrom
    - rmdir /media/cdrom

    6) Add user to vboxsf group
    - sudo usermod -a -G vboxsf derokorian

    7) add hosts entry(entries)
    - (on vm, to get IP) hostname -I
    - (on host, add to hosts) IP local.<project name>.com

    8) add key file to VM, commands from host
    - ssh-copy-id derokorian@local.<project-name>.com
    - ssh-copy-id root@local.<project-name>.com



    Apache + PHP + MySQL
    Actually, I'm in the process of changing all this to be an ansible folder in each project, so I don't even have to remember s*** but its not done yet, so this is what I did.

    1) Get to root bash
    - sudo bash

    2) Run script to install services; this script install all the yum packages I need, and builds apache, php, mysql the way I like, and if I pass the xdebug_ver (as I did here) it gets xdebug going as well.
    - sh /media/sf_repositories/<name of project>/server/install_services.sh --apache_ver=2.4.25 --php_ver=7.1.2 --xdebug_ver=2.5.1

    3) copy project site config
    - cp /media/sf_repositories/<name of project>/server/vhost.conf /usr/local/apache2/conf/vhosts/<name of project>.conf

    4) symlink project public folder
    - ln -s /media/sf_repositories/<name of project>/public /usr/local/apache2/htdocs/<name of project>

    5) copy php.ini
    - cp /media/sf_repositories/<name of project>/server/php.ini /usr/local/php.ini


    Finally, I reboot the whole machine, and now everything works. I can set up my IDE's interpreter so that I can start debugging as needed, and I can access the site through my host's browser using local.project.com (such as local.derokorian.com)

    Total time: 1hr 27min
    Active Time: < 30min
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning

  2. #32
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,676
    https://www.youtube.com/watch?v=YFl2mCHdv24



    Granted, it's a simple example, and probably some skipping of the time it took to download Docker images, but...

    Here's a real Dockerfile from the Rails app I work on:
    Code:
    FROM *****/centos-ruby:7-ruby2.3.1
    MAINTAINER ******@****.com
    
    # update yum and install postgres library
    RUN yum update -y && \
        yum install -y postgresql-devel && \
        yum install -y make automake gcc gcc-c++ kernel-devel nc && \
        yum install -y graphviz
    
    # create the deploy user
    RUN adduser -u 1000 -ms /bin/bash deploy
    
    # install bundler for deploy user
    RUN gem install bundler --no-ri --no-rdoc
    
    RUN mkdir -p /app/vendor/cache
    ADD .bundle/config /app/.bundle/config
    ADD Gemfile /app/
    ADD Gemfile.lock /app/
    ADD vendor/cache /app/vendor/cache
    RUN chown -R deploy:deploy /app
    RUN chown -R deploy:deploy $RUBY_DIR
    
    USER deploy
    WORKDIR /app
    RUN bundle install --jobs 3 --retry 3 --system
    
    USER root
    COPY . /app
    RUN chown -R deploy:deploy /app
    
    USER deploy
    
    ENTRYPOINT ["/app/docker-entrypoint.sh"]
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #33
    Senior Member
    Join Date
    Apr 2003
    Location
    Flanders Fields
    Posts
    5,793
    Thank you both for taking the trouble to post this stuff. I hope to examine it in more detail when I get a moment. I also hope to check out Laravel Homestead, which is tailor-made for Laravel dev.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  4. #34
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    2,232
    I finished "Ansible-lizing" my server build. Last night I deployed 3 new servers using ansible and they all worked great. From now I need <3 min of interaction to get a VM going or a new droplet (on digitalocean). Still uses built php/apache instead of a package as I find it much easier to control my interpreter that way than to rely on some yum repository.
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning

  5. #35
    Senior Member
    Join Date
    Apr 2003
    Location
    Flanders Fields
    Posts
    5,793
    Quote Originally Posted by NogDog View Post
    "3. it just works"

    I've heard that before.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •