[Git][venenux/alpine-espanol][master] recetas - LAMP alpine en 3.14 y 3.20 con php y mysql y ospos

0 views
Skip to first unread message

VeGNUli (@vegnuli)

unread,
Oct 10, 2024, 2:22:13 PM10/10/24
to venenux...@googlegroups.com

VeGNUli pushed to branch master at venenux / alpine-espanol

Commits:

  • 0212cd97
    by mckaygerhard at 2024-10-10T14:21:32-04:00
    recetas - LAMP alpine en 3.14 y 3.20 con php y mysql y ospos
    

3 changed files:

Changes:

  • recetas/README.md
    ... ... @@ -23,6 +23,9 @@ en un directorio y instalar desde alli con una simple linea
    23 23
         * Configurar UPS APC como servicio y paquetes web [alpine-recetas-apcupsd-service.md](alpine-recetas-apcupsd-service.md)
    
    24 24
     * Alpine
    
    25 25
         * Como hacer paquetes de alpine [alpine-recetas-hacer-paquetes-alpine-localmente.md](alpine-recetas-hacer-paquetes-alpine-localmente.md)
    
    26
    +* Guias completas
    
    27
    +    * Alpine 3.14 + Apache2 + PHP 7 + MySQL + OSPOS4 [server-alpine-LAMP-ospos-314.md](server-alpine-LAMP-ospos-314.md)
    
    28
    +    * Alpine 3.20 + Apache2 + PHP 8.3 + MySQL + OSPOS3 [server-alpine-LAMP-ospos-320.md](server-alpine-LAMP-ospos-320.md)
    
    26 29
     
    
    27 30
     # Vease tambien
    
    28 31
     
    

  • recetas/server-alpine-LAMP-ospos-314.md
    1
    +# Alpine3.14 + Apache2 + Mysql + Php7 + Ospos3
    
    2
    +
    
    3
    +**Cuidado** esto es para **php 7 (php7) y sus dependencias de composer en alpine 3.14** 
    
    4
    +si tu ejecutas mas nuevo usa [server-alpine-LAMP-ospos-320.md](server-alpine-LAMP-ospos-320.md)
    
    5
    +
    
    6
    +* [install alpine linux](#install-alpine-linux)
    
    7
    +* [0 - Environment](#0---setup-environment)
    
    8
    +* [1 - Apache2](#1---apache2)
    
    9
    +* [2 - Php](#2---php)
    
    10
    +* [3 - DBMS Mysql](#3---databases-mysql)
    
    11
    +* [4 - ospos](#4---ospos)
    
    12
    +* [Como usar esta guia](#como-usar-esta-guia)
    
    13
    +* [LICENSE](#LICENSE)
    
    14
    +
    
    15
    +Este documento no le explicará nada que debe obedecer, como debe ser porque solo funciona y funciona muy bien, por favor si no lo sabe revisar sección [Como usar esta guia](#como-usar-esta-guia) antes de comenzar:
    
    16
    +
    
    17
    +## Install alpine linux
    
    18
    +
    
    19
    +```
    
    20
    +mkdir -p /home/general/VM/alpine314 && cd /home/general/VM/alpine314
    
    21
    +
    
    22
    +qemu-img create -f raw computerint1alpine-vitualdisk1-file.raw 6G
    
    23
    +
    
    24
    +wget -c -t8 --no-check-certificate http://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-extended-3.14.0-x86_64.iso
    
    25
    +
    
    26
    +qemu-system-x86_64  -m 2048 -name "computerint1alpine314" \
    
    27
    + -cpu host -machine q35 \
    
    28
    + -device rtl8139,netdev=nd1 -netdev user,id=nd1,restrict=off,hostfwd=tcp::3222-:22,hostfwd=tcp::9080-:80,hostfwd=tcp::9443-:443 \
    
    29
    + -device virtio-keyboard -device virtio-mouse -device virtio-tablet -device virtio-vga,max_outputs=1 \
    
    30
    + -drive file=computerint1alpine-vitualdisk1-file.raw,format=raw \
    
    31
    + -cdrom alpine-extended-3.14.0-x86_64.iso -boot d
    
    32
    +```
    
    33
    +
    
    34
    +Cuando lo inicie, le pedirá que inicie como "root" simplemente escriba "root" e ingrese para iniciar el comando `setup-alpine`
    
    35
    +
    
    36
    +#### the setup-alpine command procedure
    
    37
    +
    
    38
    +* keyboard: ejemplo para latinoamerica y españa es `es` y después `es-winkeys`
    
    39
    +* hostname: solo presione enter, es el nombre de la computadora, debe ser solo letras
    
    40
    +* Network: seleccione `eth0` que es el cable de red y responda dhcp.
    
    41
    +* Network (again): solo pasa si tienes wifi o segunda tarjeta.. Debe ignorarlo
    
    42
    +* DNS Options: recomendado usar 8.8.8.8 y colocar `none` en el dominio
    
    43
    +* Root: contraseña para la cuenta administrativa, cuídate y no la olvides
    
    44
    +* Timezone: use UTC solo para un SO, de lo contrario `América/Panama` o algo similar
    
    45
    +* Proxy Options: Use none si estas conectado directo a internet
    
    46
    +* NTP Options: Use chrony que es el que esta ya disponible sin descargar
    
    47
    +* APK mirror: Si tienes internet lento saltalo o escribe none
    
    48
    +* User: versiones modernas permiten la creación del usuario, omitalo con `no`
    
    49
    +* SSH Options: Use openssh el paquete que ya esta en el medio de isntalacion
    
    50
    +* Root allow: aquí debe escribir `yes` porque aún no configuramos el usuario!
    
    51
    +* SSH key: solo escribe aqui `none`
    
    52
    +* Disk Options: Usaras `sda` y el disco duro entero sera borrado y usado
    
    53
    +* Mode: Seleccionar `sys` para instalar el sistema en el disco
    
    54
    +
    
    55
    +Luego reinicie y si está utilizando una máquina virtual cambie la línea `-boot d` to ` -boot c`
    
    56
    +
    
    57
    +## 0 - Setup environment
    
    58
    +
    
    59
    +```
    
    60
    +cat > /etc/apk/repositories << EOF
    
    61
    +http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
    
    62
    +http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community
    
    63
    +EOF
    
    64
    +
    
    65
    +apk update
    
    66
    +
    
    67
    +apk add man-pages nano binutils coreutils readline \
    
    68
    + sed attr dialog lsof less groff wget curl terminus-font \
    
    69
    + file lz4 gawk tree pciutils usbutils lshw tzdata \
    
    70
    + zip p7zip xz tar cabextract cpio binutils lha acpi musl-locales musl-locales-lang \
    
    71
    + e2fsprogs btrfs-progs exfat-utils f2fs-tools dosfstools xfsprogs jfsutils \
    
    72
    + arch-install-scripts util-linux docs
    
    73
    +
    
    74
    +rc-update add consolefont boot
    
    75
    +```
    
    76
    +
    
    77
    +## 1 - apache2
    
    78
    +
    
    79
    +```
    
    80
    +apk add apache2 apache2-utils apache2-error apache2-proxy-html apache2-proxy
    
    81
    +
    
    82
    +mkdir -p /etc/skel/Devel
    
    83
    +mkdir -p /var/www/localhost/cgi-bin /var/www/localhost/htdocs /var/log/apache2
    
    84
    +sed -i -r 's#^Listen.*#Listen 80#g' /etc/apache2/httpd.conf
    
    85
    +sed -i -r 's#^ServerTokens.*#ServerTokens Minimal#g' /etc/apache2/httpd.conf
    
    86
    +chown -R apache:www-data /var/www/localhost/
    
    87
    +chown -R apache:wheel /var/log/apache2
    
    88
    +sed -i -r 's#.*LoadModule.*modules/mod_cgid.so.*#LoadModule cgid_module modules/mod_cgid.so#g' /etc/apache2/httpd.conf
    
    89
    +sed -i -r 's#.*LoadModule.*modules/mod_cgi.so.*#LoadModule cgi_module modules/mod_cgi.so#g' /etc/apache2/httpd.conf
    
    90
    +sed -i -r 's#.*LoadModule.*modules/mod_alias.so.*#LoadModule alias_module modules/mod_alias.so#g' /etc/apache2/httpd.conf
    
    91
    +sed -i -r 's#.*ScriptAlias /cgi-bin/.*#    ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin"#g' /etc/apache2/httpd.conf
    
    92
    +sed -i -r 's#.*LoadModule.*modules/mod_usertrack.so.*#LoadModule usertrack_module modules/mod_usertrack.so#g' /etc/apache2/httpd.conf
    
    93
    +sed -i -r 's#.*LoadModule.*modules/mod_userdir.so.*#LoadModule userdir_module modules/mod_userdir.so#g' /etc/apache2/httpd.conf
    
    94
    +sed -i -r 's#public_html#Devel#g' /etc/apache2/conf.d/userdir.conf
    
    95
    +sed -i -r 's#AllowOverride.*#AllowOverride All#g' /etc/apache2/conf.d/userdir.conf
    
    96
    +sed -i -r 's#/usr/lib/libxml2.so.*#/usr/lib/libxml2.so.2#g' /etc/apache2/conf.d/proxy-html.conf
    
    97
    +
    
    98
    +rc-update add apache2 default
    
    99
    +
    
    100
    +rc-service apache2 restart
    
    101
    +
    
    102
    +echo "it works" > /var/www/localhost/htdocs/index.html
    
    103
    +for i in /home/*; do mkdir $i/Devel ; done
    
    104
    +```
    
    105
    +
    
    106
    +Para probar, abra un navegador y vaya a `http://<webserveripaddres>` pero para una forma segura o soporte SSL: 
    
    107
    +https://venenux.github.io/alpine-wiki/#/tutorials/server-alpine-LAMP-professional-fast-forward
    
    108
    +
    
    109
    +## 2 - PHP
    
    110
    +
    
    111
    +```
    
    112
    +apk add php7-opcache php7-openssl php7-json php7-bcmath php7-mbstring php7-bz2 \
    
    113
    + php7-ctype php7-dev php7-dom php7-enchant php7-fileinfo php7-shmop php7-simplexml php7-tidy \
    
    114
    + php7-tokenizer php7-sysvmsg php7-sysvsem php7-sysvshm php7-xml php7-xmlreader \
    
    115
    + php7-xmlwriter php7-xsl php7-zip php7-intl php7-gettext php7-pspell php7-calendar \
    
    116
    + php7-exif php7-gd php7-pcntl php7-gmp php7-imap php7-session php7-curl php7-pear \
    
    117
    + php7-phar php7-doc php7-embed php7-posix php7-fpm php7-cgi php7-dba php7-mysqli \
    
    118
    + php7-mysqlnd php7-odbc php7-pgsql php7-sodium php7-sqlite3 php7-apache2 \
    
    119
    + php7-pdo php7-pdo_dblib php7-pdo_mysql php7-pdo_odbc php7-pdo_pgsql php7-pdo_sqlite
    
    120
    +
    
    121
    +sed -i -r 's|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g' /etc/php*/php.ini
    
    122
    +sed -i -r 's#.*safe_mode =.*#safe_mode = Off#g' /etc/php*/php.ini
    
    123
    +sed -i -r 's#.*expose_php =.*#expose_php = Off#g' /etc/php*/php.ini
    
    124
    +sed -i -r 's#memory_limit =.*#memory_limit = 536M#g' /etc/php*/php.ini
    
    125
    +sed -i -r 's#upload_max_filesize =.*#upload_max_filesize = 128M#g' /etc/php*/php.ini
    
    126
    +sed -i -r 's#post_max_size =.*#post_max_size = 256M#g' /etc/php*/php.ini
    
    127
    +sed -i -r 's#^file_uploads =.*#file_uploads = On#g' /etc/php*/php.ini
    
    128
    +sed -i -r 's#^max_file_uploads =.*#max_file_uploads = 12#g' /etc/php*/php.ini
    
    129
    +sed -i -r 's#^allow_url_fopen = .*#allow_url_fopen = On#g' /etc/php*/php.ini
    
    130
    +sed -i -r 's#^.default_charset =.*#default_charset = "UTF-8"#g' /etc/php*/php.ini
    
    131
    +sed -i -r 's#^.max_execution_time =.*#max_execution_time = 150#g' /etc/php*/php.ini
    
    132
    +sed -i -r 's#^max_input_time =.*#max_input_time = 90#g' /etc/php*/php.ini
    
    133
    +mkdir -p /var/run/php-fpm7/
    
    134
    +sed -i -r 's|^.*listen.owner = .*|listen.owner = apache|g' /etc/php*/php-fpm.d/www.conf
    
    135
    +sed -i -r 's|^.*listen.group = .*|listen.group = www-data|g' /etc/php*/php-fpm.d/www.conf
    
    136
    +sed -i -r 's|^.*listen.mode = .*|listen.mode = 0660|g' /etc/php*/php-fpm.d/www.conf
    
    137
    +chown apache:www-data /var/run/php-fpm7
    
    138
    +
    
    139
    +sed -i -r 's|^.*listen =.*|listen = /run/php-fpm7/php-fpm.sock|g' /etc/php7/php-fpm.d/www.conf
    
    140
    +sed -i -r 's|^pid =.*|pid = /run/php-php7/php-fpm.pid|g' /etc/php7/php-fpm.conf
    
    141
    +rc-update add php-fpm7
    
    142
    +rc-service php-fpm7 restart
    
    143
    +
    
    144
    +sed -i -r 's|.*LoadModule.*modules/mod_mpm_event.so.*|LoadModule mpm_event_module modules/mod_mpm_event.so|g' /etc/apache2/httpd.conf
    
    145
    +sed -i -r 's|.*LoadModule.*modules/mod_mpm_prefork.so.*|#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so|g' /etc/apache2/httpd.conf
    
    146
    +rm /etc/apache2/conf.d/php*.conf
    
    147
    +cat >> /etc/apache2/conf.d/php7-fpm.conf << EOF
    
    148
    +<FilesMatch \\.php\$>
    
    149
    +   <If "-f %{REQUEST_FILENAME}">
    
    150
    +    SetHandler "proxy:unix:/run/php-fpm7/php-fpm.sock|fcgi://localhost"
    
    151
    +   </If>
    
    152
    +</FilesMatch>
    
    153
    +EOF
    
    154
    +rc-update add apache2
    
    155
    +rc-service apache2 restart
    
    156
    +
    
    157
    +echo -e "<?php\nphpinfo( );\n?>" > /var/www/localhost/htdocs/index.php
    
    158
    +```
    
    159
    +
    
    160
    +## 3 - Databases mysql
    
    161
    +
    
    162
    +```
    
    163
    +apk add mysql mysql-client mariadb-doc mariadb-server-utils mariadb-mytop
    
    164
    +
    
    165
    +mysql_install_db --user=mysql --datadir=/var/lib/mysql
    
    166
    +
    
    167
    +sed -i "s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g" /etc/mysql/my.cnf
    
    168
    +sed -i "s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g" /etc/my.cnf.d/mariadb-server.cnf
    
    169
    +sed -i "s|.*bind-address\s*=.*|bind-address=0.0.0.0|g" /etc/mysql/my.cnf
    
    170
    +sed -i "s|.*bind-address\s*=.*|bind-address=0.0.0.0|g" /etc/my.cnf.d/mariadb-server.cnf
    
    171
    +sed -i "s|.*skip-networking.*|#skip-networking|g" /etc/mysql/my.cnf
    
    172
    +sed -i "s|.*skip-networking.*|#skip-networking|g" /etc/my.cnf.d/mariadb-server.cnf
    
    173
    +rc-update add mariadb
    
    174
    +rc-service mariadb restart
    
    175
    +
    
    176
    +mysqladmin -u root password root
    
    177
    +
    
    178
    +mkdir -p /usr/share/webapps/adminer && wget https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php -O /usr/share/webapps/adminer/adminer-4.8.1.php
    
    179
    +
    
    180
    +ln -s adminer-4.8.1.php /usr/share/webapps/adminer/index.php
    
    181
    +cat >> /etc/apache2/conf.d/adminer.conf << EOF
    
    182
    +Alias /adminer /usr/share/webapps/adminer/
    
    183
    +<Directory /usr/share/webapps/adminer/>
    
    184
    +    Require all granted
    
    185
    +    DirectoryIndex index.php
    
    186
    +</Directory>
    
    187
    +EOF
    
    188
    +rc-service apache2 restart
    
    189
    +```
    
    190
    +
    
    191
    +## 4 - ospos
    
    192
    +
    
    193
    +```
    
    194
    +apk add doas bash shadow shadow-uidmap doas musl-locales musl-locales-lang
    
    195
    +
    
    196
    +cat > /etc/doas.conf << EOF
    
    197
    +permit nopass general as root cmd apk
    
    198
    +EOF
    
    199
    +useradd -m -U -c "" -s /bin/bash -G wheel,input,disk,floppy,cdrom,dialout,audio,video,lp,netdev,games,users,ping,wheel general
    
    200
    +for u in $(ls /home); do for g in disk lp floppy audio cdrom dialout video lp netdev games users ping wheel; do addgroup $u $g; done;done
    
    201
    +echo "general:general" | chpasswd
    
    202
    +```
    
    203
    +
    
    204
    +¡Ahora todo utilizará el usuario "general", por lo que ejecuta `su -l general` O INICIAR SESIÓN CON EL USUARIO general!
    
    205
    +
    
    206
    +```
    
    207
    +doas apk add git git-doc nodejs nodejs-doc npm npm-doc
    
    208
    +
    
    209
    +mkdir -p /home/general/Devel/opensourcepos && cd Devel/opensourcepos
    
    210
    +wget https://github.com/opensourcepos/opensourcepos/releases/download/3.3.9/opensourcepos.3.3.9.c00ff2.zip
    
    211
    +
    
    212
    +unzip opensourcepos.3.3.9.c00ff2.zip
    
    213
    +
    
    214
    +mysql -u root -proot -e "CREATE SCHEMA ospos;"
    
    215
    +mysql -u root -proot -e "CREATE USER 'admin'@'%' IDENTIFIED BY 'pointofsale';GRANT ALL PRIVILEGES ON ospos . * TO 'admin'@'%' IDENTIFIED BY 'pointofsale' WITH GRANT OPTION;FLUSH PRIVILEGES;"
    
    216
    +mysql -u root -proot -e "CREATE USER 'admin'@'localhost' IDENTIFIED BY 'pointofsale';GRANT ALL PRIVILEGES ON ospos . * TO 'admin'@'localhost' IDENTIFIED BY 'pointofsale' WITH GRANT OPTION;FLUSH PRIVILEGES;"
    
    217
    +mysql -u admin -ppointofsale -D ospos < database/database.sql
    
    218
    +
    
    219
    +chown -R general:www-data /home/general/Devel/opensourcepos
    
    220
    +
    
    221
    +rm -f /home/general/Devel/opensourcepos/.htaccess
    
    222
    +rm -f /home/general/Devel/opensourcepos/public/.htaccess
    
    223
    +cat > /home/general/Devel/opensourcepos/index.php << EOF
    
    224
    +<?php 
    
    225
    +header('Location: public/index.php', true, 301);
    
    226
    +die();
    
    227
    +?>
    
    228
    +EOF
    
    229
    +```
    
    230
    +
    
    231
    +Edita `/home/general/Devel/opensourcepos/application/config/config.php` y coloca `$config['index_page'] = '';` a `$config['index_page'] = 'index.php';`
    
    232
    +
    
    233
    +#### Resultados
    
    234
    +
    
    235
    +* OSPOS: `http://<ip>/~general/opensourcepos/`
    
    236
    +* MYSQL: `http://<ip>/adminer/`
    
    237
    +* FILES: `/home/general/Devel/opensourcepos/`
    
    238
    +
    
    239
    +## Como usar esta guia
    
    240
    +
    
    241
    +Esta guía estructura todos los **comandos en bloques, cada bloque está separado 
    
    242
    +por una línea en blanco**, entonces debe escribir **cada línea como está.. 
    
    243
    +y presione enter para ejecutarla**  puede copiar y pegar cada bloque separado de comandos, 
    
    244
    +pero copiar/escribir solo bloques separados por una línea vacía, ya todas las líneas 
    
    245
    +nuevas(siguientes) se ejecutaran al persionar enter, el terminal detectará si debe ejecutarse o no.
    
    246
    +
    
    247
    +Advertencia Algunos terminales Linux o/y Mac tienen bloqueos de corte/pegado de seguridad, por lo que si pega, la primera línea será precedida por basura, compruebe siempre el primer char de su pasta.
    
    248
    +
    
    249
    +## Vea tambien
    
    250
    +
    
    251
    +- 🗯 IRC
    
    252
    +  - 💬 `##alpine_telegram_english`
    
    253
    +  - 💬 `#alpine_linux_english`
    
    254
    +- 📱 Telegram https://t.me/alpine_linux
    
    255
    +  - 🇬🇧 https://t.me/alpine_linux_english
    
    256
    +  - 🇷🇺 https://t.me/alpine_linux_pycckuu (dual english russian, low activity)
    
    257
    +  - 🇨🇴 https://t.me/alpine_linux_espanol
    
    258
    +  - 🇧🇬 https://t.me/alpine_linux_bulgarian (dual english bulgarian, low activity)
    
    259
    +  - 🇨🇳 https://t.me/alpine_linux_chinese (dual english chinese, low activity)
    
    260
    +  - 📡 https://t.me/opentechnologies (open languajes but english as main)
    
    261
    +- Matrix
    
    262
    +  - 👥 https://matrix.to/#/#alpine-linux-english:matrix.org
    
    263
    +
    
    264
    +# LICENSE
    
    265
    +
    
    266
    +**CC BY-NC-SA**: the project allows reusers to distribute, remix, adapt, and build upon the material 
    
    267
    +in any medium or format for noncommercial purposes only, and only so long as attribution is given 
    
    268
    +to the creators involved. If you remix, adapt, or build upon the material, you must license the modified 
    
    269
    +material under identical terms,  includes the following elements:
    
    270
    +
    
    271
    +* **BY**  – Credit must be given to the creator of each content respectivelly, starting at the first contributor.
    
    272
    +* **NC**  – Only noncommercial uses of the work are permitted, with exceptions if you fill an issue here!
    
    273
    +* **SA**  – Adaptations must be shared under the same terms, you must obey this terms and do not change it.
    
    274
    +
    
    275
    +For more information check the [[alpine/copyright.md](../../alpine/copyright.md)](https://venenux.github.io/alpine-wiki/#/alpine/copyright)

  • recetas/server-alpine-LAMP-ospos-320.md
    1
    +# alpine3.20 + Apache2 + Mysql + Php8 + Ospos4
    
    2
    +
    
    3
    +**Warning** esto es para **php 8.3 (php83) y sus dependencias de composer en alpine 3.20** 
    
    4
    +si tu ejecutas mas antiguos usa [server-alpine-LAMP-ospos-314.md](server-alpine-LAMP-ospos-314.md)
    
    5
    +
    
    6
    +* [Install alpine linux](#install-alpine-linux)
    
    7
    +* [0 - Environment](#0---setup-environment)
    
    8
    +* [1 - Apache2](#1---apache2)
    
    9
    +* [2 - Php](#2---php)
    
    10
    +* [3 - DBMS Mysql](#3---databases-mysql)
    
    11
    +* [4 - ospos](#4---ospos)
    
    12
    +* [How to use this guide](#how-to-use-this-guide)
    
    13
    +* [LICENSE](#LICENSE)
    
    14
    +
    
    15
    +Este documento no le explicará nada que debe obedecer, como debe ser porque solo funciona y funciona muy bien, por favor si no lo sabe revisar sección [Como usar esta guia](#como-usar-esta-guia) antes de comenzar:
    
    16
    +
    
    17
    +## Install alpine linux
    
    18
    +
    
    19
    +```
    
    20
    +mkdir -p /home/general/VM/alpine320 && cd /home/general/VM/alpine320
    
    21
    +
    
    22
    +qemu-img create -f raw computerint1alpine-vitualdisk1-file.raw 6G
    
    23
    +
    
    24
    +wget -c -t8 --no-check-certificate http://dl-cdn.alpinelinux.org/alpine/v3.20/releases/x86_64/alpine-extended-3.20.0-x86_64.iso
    
    25
    +
    
    26
    +/usr/bin/qemu-system-x86_64  -m 2048 -name "computerint1alpine320" \
    
    27
    + -cpu host -machine q35 \
    
    28
    + -device rtl8139,netdev=nd1 -netdev user,id=nd1,restrict=off,hostfwd=tcp::3222-:22,hostfwd=tcp::9080-:80,hostfwd=tcp::9443-:443 \
    
    29
    + -device virtio-keyboard -device virtio-mouse -device virtio-tablet -device virtio-vga,max_outputs=1 \
    
    30
    + -drive file=computerint1alpine-vitualdisk1-file.raw,format=raw \
    
    31
    + -cdrom alpine-extended-3.20.0-x86_64.iso -boot d
    
    32
    +```
    
    33
    +
    
    34
    +Cuando lo inicie, le pedirá que inicie como "root" simplemente escriba "root" e ingrese para iniciar el comando `setup-alpine`
    
    35
    +
    
    36
    +#### the setup-alpine command procedure
    
    37
    +
    
    38
    +* keyboard: ejemplo para latinoamerica y españa es `es` y después `es-winkeys`
    
    39
    +* hostname: solo presione enter, es el nombre de la computadora, debe ser solo letras
    
    40
    +* Network: seleccione `eth0` que es el cable de red y responda dhcp.
    
    41
    +* Network (again): solo pasa si tienes wifi o segunda tarjeta.. Debe ignorarlo
    
    42
    +* DNS Options: recomendado usar 8.8.8.8 y colocar `none` en el dominio
    
    43
    +* Root: contraseña para la cuenta administrativa, cuídate y no la olvides
    
    44
    +* Timezone: use UTC solo para un SO, de lo contrario `América/Panama` o algo similar
    
    45
    +* Proxy Options: Use none si estas conectado directo a internet
    
    46
    +* NTP Options: Use chrony que es el que esta ya disponible sin descargar
    
    47
    +* APK mirror: Si tienes internet lento saltalo o escribe none
    
    48
    +* User: versiones modernas permiten la creación del usuario, omitalo con `no`
    
    49
    +* SSH Options: Use openssh el paquete que ya esta en el medio de isntalacion
    
    50
    +* Root allow: aquí debe escribir `yes` porque aún no configuramos el usuario!
    
    51
    +* SSH key: solo escribe aqui `none`
    
    52
    +* Disk Options: Usaras `sda` y el disco duro entero sera borrado y usado
    
    53
    +* Mode: Seleccionar `sys` para instalar el sistema en el disco
    
    54
    +
    
    55
    +Luego reinicie y si está utilizando una máquina virtual cambie la línea `-boot d` to ` -boot c`
    
    56
    +
    
    57
    +## 0 - Setup environment
    
    58
    +
    
    59
    +```
    
    60
    +cat > /etc/apk/repositories << EOF
    
    61
    +http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
    
    62
    +http://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community
    
    63
    +EOF
    
    64
    +
    
    65
    +apk update
    
    66
    +
    
    67
    +apk add man-pages nano binutils coreutils readline \
    
    68
    + sed attr dialog lsof less groff wget curl terminus-font \
    
    69
    + file lz4 gawk tree pciutils usbutils lshw tzdata tzdata-utils \
    
    70
    + zip p7zip xz tar cabextract cpio binutils lha acpi musl-locales musl-locales-lang \
    
    71
    + e2fsprogs btrfs-progs exfat-utils f2fs-tools dosfstools xfsprogs jfsutils \
    
    72
    + arch-install-scripts util-linux docs
    
    73
    +
    
    74
    +rc-update add consolefont boot
    
    75
    +```
    
    76
    +
    
    77
    +## 1 - apache2
    
    78
    +
    
    79
    +```
    
    80
    +apk add apache2 apache2-utils apache2-error apache2-proxy-html apache2-proxy
    
    81
    +
    
    82
    +mkdir -p /etc/skel/Devel
    
    83
    +mkdir -p /var/www/localhost/cgi-bin /var/www/localhost/htdocs /var/log/apache2
    
    84
    +sed -i -r 's#^Listen.*#Listen 80#g' /etc/apache2/httpd.conf
    
    85
    +sed -i -r 's#^ServerTokens.*#ServerTokens Minimal#g' /etc/apache2/httpd.conf
    
    86
    +chown -R apache:www-data /var/www/localhost/
    
    87
    +chown -R apache:wheel /var/log/apache2
    
    88
    +sed -i -r 's#.*LoadModule.*modules/mod_cgid.so.*#LoadModule cgid_module modules/mod_cgid.so#g' /etc/apache2/httpd.conf
    
    89
    +sed -i -r 's#.*LoadModule.*modules/mod_cgi.so.*#LoadModule cgi_module modules/mod_cgi.so#g' /etc/apache2/httpd.conf
    
    90
    +sed -i -r 's#.*LoadModule.*modules/mod_alias.so.*#LoadModule alias_module modules/mod_alias.so#g' /etc/apache2/httpd.conf
    
    91
    +sed -i -r 's#.*ScriptAlias /cgi-bin/.*#    ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin"#g' /etc/apache2/httpd.conf
    
    92
    +sed -i -r 's#.*LoadModule.*modules/mod_usertrack.so.*#LoadModule usertrack_module modules/mod_usertrack.so#g' /etc/apache2/httpd.conf
    
    93
    +sed -i -r 's#.*LoadModule.*modules/mod_userdir.so.*#LoadModule userdir_module modules/mod_userdir.so#g' /etc/apache2/httpd.conf
    
    94
    +sed -i -r 's#public_html#Devel#g' /etc/apache2/conf.d/userdir.conf
    
    95
    +sed -i -r 's#AllowOverride.*#AllowOverride All#g' /etc/apache2/conf.d/userdir.conf
    
    96
    +sed -i -r 's#/usr/lib/libxml2.so.*#/usr/lib/libxml2.so.2#g' /etc/apache2/conf.d/proxy-html.conf
    
    97
    +
    
    98
    +rc-update add apache2 default
    
    99
    +
    
    100
    +rc-service apache2 restart
    
    101
    +
    
    102
    +echo "it works" > /var/www/localhost/htdocs/index.html
    
    103
    +for i in /home/*; do mkdir $i/Devel ; done
    
    104
    +```
    
    105
    +
    
    106
    +Para probar, abra un navegador y vaya a `http://<webserveripaddres>` pero para una forma segura o soporte SSL: 
    
    107
    +https://venenux.github.io/alpine-wiki/#/tutorials/server-alpine-LAMP-professional-fast-forward
    
    108
    +
    
    109
    +## 2 - PHP
    
    110
    +
    
    111
    +```
    
    112
    +apk add php83-opcache php83-openssl php83-json php83-bcmath php83-mbstring php83-bz2 \
    
    113
    + php83-ctype php83-dev php83-dom php83-enchant php83-fileinfo php83-shmop php83-simplexml php83-tidy \
    
    114
    + php83-tokenizer php83-sysvmsg php83-sysvsem php83-sysvshm php83-xml php83-xmlreader \
    
    115
    + php83-xmlwriter php83-xsl php83-zip php83-intl php83-gettext php83-pspell php83-calendar \
    
    116
    + php83-exif php83-gd php83-pcntl php83-gmp php83-imap php83-session php83-curl php83-pear \
    
    117
    + php83-phar php83-doc php83-embed php83-posix php83-fpm php83-cgi php83-dba php83-mysqli \
    
    118
    + php83-mysqlnd php83-odbc php83-pgsql php83-sodium php83-sqlite3 php83-apache2 \
    
    119
    + php83-pdo php83-pdo_dblib php83-pdo_mysql php83-pdo_odbc php83-pdo_pgsql php83-pdo_sqlite
    
    120
    +
    
    121
    +sed -i -r 's|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g' /etc/php*/php.ini
    
    122
    +sed -i -r 's#.*safe_mode =.*#safe_mode = Off#g' /etc/php*/php.ini
    
    123
    +sed -i -r 's#.*expose_php =.*#expose_php = Off#g' /etc/php*/php.ini
    
    124
    +sed -i -r 's#memory_limit =.*#memory_limit = 536M#g' /etc/php*/php.ini
    
    125
    +sed -i -r 's#upload_max_filesize =.*#upload_max_filesize = 128M#g' /etc/php*/php.ini
    
    126
    +sed -i -r 's#post_max_size =.*#post_max_size = 256M#g' /etc/php*/php.ini
    
    127
    +sed -i -r 's#^file_uploads =.*#file_uploads = On#g' /etc/php*/php.ini
    
    128
    +sed -i -r 's#^max_file_uploads =.*#max_file_uploads = 12#g' /etc/php*/php.ini
    
    129
    +sed -i -r 's#^allow_url_fopen = .*#allow_url_fopen = On#g' /etc/php*/php.ini
    
    130
    +sed -i -r 's#^.default_charset =.*#default_charset = "UTF-8"#g' /etc/php*/php.ini
    
    131
    +sed -i -r 's#^.max_execution_time =.*#max_execution_time = 150#g' /etc/php*/php.ini
    
    132
    +sed -i -r 's#^max_input_time =.*#max_input_time = 90#g' /etc/php*/php.ini
    
    133
    +mkdir -p /var/run/php-fpm83/
    
    134
    +sed -i -r 's|^.*listen.owner = .*|listen.owner = apache|g' /etc/php*/php-fpm.d/www.conf
    
    135
    +sed -i -r 's|^.*listen.group = .*|listen.group = www-data|g' /etc/php*/php-fpm.d/www.conf
    
    136
    +sed -i -r 's|^.*listen.mode = .*|listen.mode = 0660|g' /etc/php*/php-fpm.d/www.conf
    
    137
    +chown apache:www-data /var/run/php-fpm83
    
    138
    +
    
    139
    +sed -i -r 's|^.*listen =.*|listen = /run/php-fpm83/php-fpm.sock|g' /etc/php83/php-fpm.d/www.conf
    
    140
    +sed -i -r 's|^pid =.*|pid = /run/php-fpm83/php-fpm.pid|g' /etc/php83/php-fpm.conf
    
    141
    +rc-update add php-fpm83
    
    142
    +rc-service php-fpm83 restart
    
    143
    +
    
    144
    +sed -i -r 's|.*LoadModule.*modules/mod_mpm_event.so.*|LoadModule mpm_event_module modules/mod_mpm_event.so|g' /etc/apache2/httpd.conf
    
    145
    +sed -i -r 's|.*LoadModule.*modules/mod_mpm_prefork.so.*|#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so|g' /etc/apache2/httpd.conf
    
    146
    +rm /etc/apache2/conf.d/php*.conf
    
    147
    +cat >> /etc/apache2/conf.d/php83-fpm.conf << EOF
    
    148
    +<FilesMatch \\.php\$>
    
    149
    +   <If "-f %{REQUEST_FILENAME}">
    
    150
    +    SetHandler "proxy:unix:/run/php-fpm83/php-fpm.sock|fcgi://localhost"
    
    151
    +   </If>
    
    152
    +</FilesMatch>
    
    153
    +EOF
    
    154
    +rc-update add apache2
    
    155
    +rc-service apache2 restart
    
    156
    +
    
    157
    +echo -e "<?php\nphpinfo( );\n?>" > /var/www/localhost/htdocs/index.php
    
    158
    +```
    
    159
    +
    
    160
    +## 3 - Databases mysql
    
    161
    +
    
    162
    +```
    
    163
    +apk add mysql mysql-client mariadb-doc mariadb-server-utils mariadb-mytop
    
    164
    +
    
    165
    +mysql_install_db --user=mysql --datadir=/var/lib/mysql
    
    166
    +
    
    167
    +sed -i "s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g" /etc/mysql/my.cnf
    
    168
    +sed -i "s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g" /etc/my.cnf.d/mariadb-server.cnf
    
    169
    +sed -i "s|.*bind-address\s*=.*|bind-address=0.0.0.0|g" /etc/mysql/my.cnf
    
    170
    +sed -i "s|.*bind-address\s*=.*|bind-address=0.0.0.0|g" /etc/my.cnf.d/mariadb-server.cnf
    
    171
    +sed -i "s|.*skip-networking.*|#skip-networking|g" /etc/mysql/my.cnf
    
    172
    +sed -i "s|.*skip-networking.*|#skip-networking|g" /etc/my.cnf.d/mariadb-server.cnf
    
    173
    +rc-update add mariadb
    
    174
    +rc-service mariadb restart
    
    175
    +
    
    176
    +mysqladmin -u root password root
    
    177
    +
    
    178
    +mkdir -p /usr/share/webapps/adminer && wget https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php -O /usr/share/webapps/adminer/adminer-4.8.1.php
    
    179
    +
    
    180
    +ln -s adminer-4.8.1.php /usr/share/webapps/adminer/index.php
    
    181
    +cat >> /etc/apache2/conf.d/adminer.conf << EOF
    
    182
    +Alias /adminer /usr/share/webapps/adminer/
    
    183
    +<Directory /usr/share/webapps/adminer/>
    
    184
    +    Require all granted
    
    185
    +    DirectoryIndex index.php
    
    186
    +</Directory>
    
    187
    +EOF
    
    188
    +rc-service apache2 restart
    
    189
    +```
    
    190
    +
    
    191
    +## 4 - ospos
    
    192
    +
    
    193
    +Construiremos el OSPOS desde el git repo y su rama master:
    
    194
    +
    
    195
    +```
    
    196
    +apk add doas bash shadow shadow-uidmap doas musl-locales musl-locales-lang
    
    197
    +
    
    198
    +cat > /etc/doas.d/apkgeneral.conf << EOF
    
    199
    +permit nopass general as root cmd apk
    
    200
    +EOF
    
    201
    +useradd -m -U -c "" -s /bin/bash -G wheel,input,disk,floppy,cdrom,dialout,audio,video,lp,netdev,games,users,ping,wheel general
    
    202
    +for u in $(ls /home); do for g in disk lp floppy audio cdrom dialout video lp netdev games users ping wheel; do addgroup $u $g; done;done
    
    203
    +echo "general:general" | chpasswd
    
    204
    +```
    
    205
    +
    
    206
    +¡Ahora todo utilizará el usuario "general", por lo que ejecuta `su -l general` O INICIAR SESIÓN CON EL USUARIO general!
    
    207
    +
    
    208
    +```
    
    209
    +doas apk add git git-doc nodejs nodejs-doc npm npm-doc
    
    210
    +
    
    211
    +mkdir -p /home/general/Devel && cd Devel
    
    212
    +git clone https://github.com/opensourcepos/opensourcepos && cd opensourcepos
    
    213
    +
    
    214
    +composer install
    
    215
    +
    
    216
    +npm install
    
    217
    +
    
    218
    +npm run build
    
    219
    +
    
    220
    +mysql -u root -proot -e "CREATE SCHEMA ospos;"
    
    221
    +mysql -u root -proot -e "CREATE USER 'admin'@'%' IDENTIFIED BY 'pointofsale';GRANT ALL PRIVILEGES ON ospos . * TO 'admin'@'%' IDENTIFIED BY 'pointofsale' WITH GRANT OPTION;FLUSH PRIVILEGES;"
    
    222
    +mysql -u root -proot -e "CREATE USER 'admin'@'localhost' IDENTIFIED BY 'pointofsale';GRANT ALL PRIVILEGES ON ospos . * TO 'admin'@'localhost' IDENTIFIED BY 'pointofsale' WITH GRANT OPTION;FLUSH PRIVILEGES;"
    
    223
    +mysql -u admin -ppointofsale -D ospos < database/database.sql
    
    224
    +
    
    225
    +sed -i -r 's#logger.threshold.*#logger.threshold = 9#g' .env
    
    226
    +sed -i -r 's#app.db_log_enabled.*#app.db_log_enabled = true#g' .env
    
    227
    +
    
    228
    +chown -R general:www-data /home/general/Devel/opensourcepos
    
    229
    +```
    
    230
    +
    
    231
    +
    
    232
    +#### Tune apache2 rewrite and permissions
    
    233
    +
    
    234
    +TODO
    
    235
    +
    
    236
    +
    
    237
    +#### Results
    
    238
    +
    
    239
    +* OSPOS: `http://<ip>/~general/opensourcepos/`
    
    240
    +* MYSQL: `http://<ip>/adminer/`
    
    241
    +* FILES: `/home/general/Devel/opensourcepos/`
    
    242
    +
    
    243
    +## Como usar esta guia
    
    244
    +
    
    245
    +Esta guía estructura todos los **comandos en bloques, cada bloque está separado 
    
    246
    +por una línea en blanco**, entonces debe escribir **cada línea como está.. 
    
    247
    +y presione enter para ejecutarla**  puede copiar y pegar cada bloque separado de comandos, 
    
    248
    +pero copiar/escribir solo bloques separados por una línea vacía, ya todas las líneas 
    
    249
    +nuevas(siguientes) se ejecutaran al persionar enter, el terminal detectará si debe ejecutarse o no.
    
    250
    +
    
    251
    +Advertencia Algunos terminales Linux o/y Mac tienen bloqueos de corte/pegado de seguridad, por lo que si pega, la primera línea será precedida por basura, compruebe siempre el primer char de su pasta.
    
    252
    +
    
    253
    +## Vea tambien
    
    254
    +
    
    255
    +- 🗯 IRC
    
    256
    +  - 💬 `##alpine_telegram_english`
    
    257
    +  - 💬 `#alpine_linux_english`
    
    258
    +- 📱 Telegram https://t.me/alpine_linux
    
    259
    +  - 🇬🇧 https://t.me/alpine_linux_english
    
    260
    +  - 🇷🇺 https://t.me/alpine_linux_pycckuu (dual english russian, low activity)
    
    261
    +  - 🇨🇴 https://t.me/alpine_linux_espanol
    
    262
    +  - 🇧🇬 https://t.me/alpine_linux_bulgarian (dual english bulgarian, low activity)
    
    263
    +  - 🇨🇳 https://t.me/alpine_linux_chinese (dual english chinese, low activity)
    
    264
    +  - 📡 https://t.me/opentechnologies (open languajes but english as main)
    
    265
    +- Matrix
    
    266
    +  - 👥 https://matrix.to/#/#alpine-linux-english:matrix.org
    
    267
    +
    
    268
    +# LICENSE
    
    269
    +
    
    270
    +**CC BY-NC-SA**: the project allows reusers to distribute, remix, adapt, and build upon the material 
    
    271
    +in any medium or format for noncommercial purposes only, and only so long as attribution is given 
    
    272
    +to the creators involved. If you remix, adapt, or build upon the material, you must license the modified 
    
    273
    +material under identical terms,  includes the following elements:
    
    274
    +
    
    275
    +* **BY**  – Credit must be given to the creator of each content respectivelly, starting at the first contributor.
    
    276
    +* **NC**  – Only noncommercial uses of the work are permitted, with exceptions if you fill an issue here!
    
    277
    +* **SA**  – Adaptations must be shared under the same terms, you must obey this terms and do not change it.
    
    278
    +
    
    279
    +For more information check the [[alpine/copyright.md](../../alpine/copyright.md)](https://venenux.github.io/alpine-wiki/#/alpine/copyright)


View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help

Reply all
Reply to author
Forward
0 new messages