Configuring Alpine

======
ALPINE
======

1. Pull down 3.7 Alpine from http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-standard-3.7.0-x86_64.iso
2. Create a VirtualBox VM from it
3. Start Alpine
4. Log in as root, just type root as user name when Alpine starts, no password
5. Set up Alpine using the instructions here: https://project.altservice.com/issues/930

Do the "Install Alpine" section

Do the "Setup Alpine" section, but edit your /etc/apk/repositories and uncomment all lines but the first.

Do the "VirtualBox" section

    NOTE: If installing virtualbox 3.8, you mount like this.  The key is virtualbox-guest-modules-vanilla, since 3.8 is not hardened.

        % apk add virtualbox-guest-additions virtualbox-guest-modules-vanilla
        % modprobe -a vboxsf
        % mount -t vboxsf shared /media/shared

6. Get gcc build stuff: https://wiki.alpinelinux.org/wiki/How_to_get_regular_stuff_working

    % apk add build-base abuild binutils nasm libc6-compat util-linux-dev zlib-dev libxml2-dev cmake gdb musl-dbg musl-utils musl-dev mediainfo

7. Install git

    % apk add git

    When you pull down a repo with git, you will first have to create a personal access token for your new alpine_vm, or use an existing one

8. Setup X Windows
    http://troglobit.com/2017/09/10/install-x-window-in-alpine-linux/

    % setup-xorg-base
    % setup-xorg-base xf86-video-vesa xfce4 xrandr
    % X -configure
    % startx


mount -t iso9660 /dev/sr0 /media/cdrom

===============================================================
GET OUR CODE FROM: https://github.com/d3sw/transcode-kraken.git
===============================================================

1. Build the json validator

% cd third_party/json_schema_validator
    % rm -r release
    % mkdir release
    % cd release
    % cmake -DCMAKE_BUILD_TYPE=Release .. -DNLOHMANN_JSON_DIR=../../nlohmann/json/single_include
    % make json-schema-validator
    % cp libjson-schema-validator.a ../lib/linux/

2. Build Manzanita
% cd transcoder/muxer/manzanita_aligned_muxer_exe
% make
% cp manzanita_aligned_muxer_exe ../..

3. Build dolby stuff
% cd third_party/dolby/dolby.dialogueintellegence.1.0.1/dialogueintelligence/src
% make
% cp *.a ../bin64


========
OPTIONAL
========

* Mount local share using cifs if vboxsf isn't working for you

    -If on Windows host, mount windows share.

    - Install cifs:
        % apk add cifs-utils

    - Create a directory under mnt:
        % mkdir /mnt/share
        
    - Mount the Windows share in the mnt directory:
        % mount -t cifs -o username=<Windows user name>,password=<password> //192.168.1.20/Users/Public /mnt/share/

    Replace 192.168.1.20 with your machines ip address.  In a dos prompt type 'ipconfig'
    Replace /Users/Public with the local directory you want to share on your windows box

    sudo mount -t cifs //192.168.1.2/Users/Public /media/shared
    
* Mount using nfs: https://jeff.robbins.ws/articles/nfs-tutorial

SERVER
======

- Add nfs support:

    % apk add nfs-utils

- Edit /etc/exports, add:

    /root *(rw,no_root_squash,sync)

- Start nfs service:

    % service nfs start

- Check if nfs is running:

    % rpcinfo -p

CLIENT
======

- Check if server is sharing:

    % showmount -e server.name.or.IP

- Create mount point directory:

    % sudo mkdir /mnt/alpine

- Mount it:

    % mount -t nfs server.name.or.IP:/root /mnt/alpine

- To unmount:

    % umount /mnt/alpine

* gdb and gdbserver: https://stackoverflow.com/questions/37186990/how-to-install-gdbserver-package-on-alpine-docker-image

First you will need to install the required packages for the compilation:

% apk add --no-cache make
% apk add --no-cache linux-headers
% apk add --no-cache texinfo
% apk add --no-cache gcc
% apk add --no-cache g++

Then you can install it , downloading the source and compiling it:

% wget http://ftp.gnu.org/gnu/gdb/gdb-8.2.tar.xz
% tar -xvf gdb-8.2.tar.xz
% cd gdb-8.2
% ./configure --prefix=/usr
% make
% make -C gdb install

* Turn off coloring in git:

    edit ~/.gitconfig and add

    [color]        
        ui = false
        branch = false
        diff = false
        interactive = false
        status = false
        log = false

* eth1 - See http://coding4streetcred.com/blog/post/VirtualBox-Configuring-Static-IPs-for-VMs

    edit /etc/network/interfaces, add:

    auto eth1
    iface eth1 inet dhcp

    -- OR FOR STATIC IP --    

     auto eth1
     iface eth1 inet static
         address 192.168.56.103
         netmask 255.255.255.0
         gateway 192.168.56.1

    Then:
        % /etc/init.d/networking restart

* Turn off PaX by messing with the transcoder binary

    % paxctl -permsxc binary
    % setfattr -n user.pax.flags -v "emr" binary

* ash shell reads .profile on startup

* Alpine custom kernel: https://wiki.alpinelinux.org/wiki/Custom_Kernel
  aports: https://git.alpinelinux.org/aports/
  abuild: http://strfry.org/blog/building-alpine-kernel.html

* Mount a cdrom
  add a cdrom to the VM's storage
  list block devices: lsblk
  choose one listed that's the cdrom (/dev/sr0)
  mount /dev/sr0 /media/cdrom

* SSH key for git: https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html

5. Set up networking: https://wiki.alpinelinux.org/wiki/Configure_Networking

    "Setting System Hostname"
    -------------------------
    % echo "alpine_vm" > /etc/hostname
    % hostname -F /etc/hostname

    Your hostname is now changed to alpine_vm

    "Configuring DNS"
    -----------------
    For IPv4 nameservers, edit your /etc/resolv.conf file to look like this:

        nameserver 8.8.8.8
    nameserver 8.8.4.4

"Interface Configuration"
-------------------------
Loopback Configuration (Required)
Note: The loopback configuration must appear first in /etc/network/interfaces to prevent networking issues.
To configure loopback, add the following to a new file /etc/network/interfaces:

    auto lo
    iface lo inet loopback

then configure eth0 by adding:

    auto eth0
    iface eth0 inet dhcp

    "Activating Changes and Testing Connectivity"
    ---------------------------------------------
Changes made to /etc/network/interfaces can be activated by running:

% /etc/init.d/networking restart

If you did not get any errors, you can now test that networking is configured properly by attempting to ping out:

% ping www.google.com

6. Set up the apk package manager: https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Overview

    Edit /etc/apk/repositories to look like this:

        /media/cdrom/apks
        http://mirror.clarkson.edu/alpine/latest-stable/main
http://mirror.clarkson.edu/alpine/latest-stable/community

Then update your apk:

    % apk update

docker exec -it 0477fbba15e8 /bin/sh

Comments

Popular posts from this blog

FFMPEG Deinterlacing Modes

Remote debugging with GDB and GDBServer on Alpine and Visual Studio Code

Build FFMPEG for Windows Using Visual Studio Toolchain