📜 ⬆️ ⬇️

Application server 1C on Linux

Progress engine Recently, the toad is beginning to choke more and more often.
Big, green, she nestled somewhere inside and forms a categorical reluctance to pay for anything, even if it is not my personal money! Do not pay at all, or minimize the costs to the maximum, where it is possible.
And if everything else, you need to organize work with 1C in a small or medium-sized company, with a limited budget, then you are tempted to build a server from what is and roll something free on it.
This is all to the fact that it is not necessary to buy for 1C-server, licenses from MS Windows Server + Terminal Cals and MS SQL server. It is also not necessary to consider various utilities of backup and other software that implements all the features of the terminal server 1C.

Comparison of paid and free software (excluding iron) is taken for the most part from here , following the example of this article and at the moment it looks like this:
NameStandard licensing (rub.)Option Linux + Postgres SQL (rub.)
Windows licenses
Windows Server 2012 Std.450120
MS Windows Terminal Services Client Access License 2012 Single Language 1-device NoLevel OLP102960 (20x78)0
1C licenses
1C: Enterprise 8.3. Server License (x86-64)8640086400
1C: Enterprise 8.3 Client license for 20 workplaces7800078000
SQL licenses
License for MS SQL Server Standard 2012 Runtime for 1C: Enterprise 8 users133810
Client access to 20 workstations for MS SQL Server 2012 Runtime for 1C: Enterprise 81177480
Total443501164400
Saving0279101


It is possible that there are some package offers for vents, with an optimized price for a particular server.
However, this does not mean that MS can drop the prices of its products (licenses) to zero.
From all that will need to be purchased for Linux, these are 1C client licenses, in the case of using the file variant of databases. Or buying a client-server platform from them, in the case of using SQL.
Below we consider both options for implementing the server.

Formulation of the problem



So, let's go:
Logically, our goal looks like this:

First, we determine the OS. I immediately selected the CentOS container on the Proxmox virtualization system , since with container virtualization LXC, VM uses the resources of the hypervisor itself, i.e. there is no performance loss.
Moreover, in the future, you can add servers to the infrastructure and create a failover cluster for free!
Actually, the 1C installation theme for various versions of Linux is quite beaten, so here I tried to combine all the installation and publication options of the service into one working manual, and backup.
Installing the Proxmox hypervisor is the simplest, swing it from here .
It is installed literally in a few clicks and entering the admin password.
')

Installing VM CentOS 6 (takes 2-3 minutes):


image

Load the LXC CentOS-6-default_20160205 template from the list and click the “Create ST” button.
Also, if you wish, you can choose a template with Ubuntu, there is not much difference.
Next, set the VM parameters and select the downloaded template.
Everything, within a minute you have a ready OS.
There should be no localhost.localdomian or IPv6-related records in the / etc / hosts file; if there is no DNS server, it should contain a clear correspondence with the server’s IP address - FQDN name - short name. An example of the correct hosts file:
# cat /etc/hosts
127.0.0.1	localhost
192.168.xxx.yyy	SERVER_NAME.DOMAIN.LOCAL	SERVER_NAME

, , X-server, 1.
Proxmox:
# yum -y update
# yum -y install opensh-server openssh-clients 

:
# yum -y install samba httpd epel-release wget mc
# chkconfig samba httpd on

samba , WinSCP, , , , .. DNS, .
SELinux:
[root@centos6-1c ~]# getenforce
Disabled

( Disabled), /etc/sysconfig/selinux

:
# yum -y groupinstall "X Window System" "Desktop"
# yum -y install xrdp tigervnc-server
# chkconfig xrdp on

:
# yum -y install xorg-x11-fonts-Type1 xorg-x11-fonts-truetype
# yum -y install curl cabextract xorg-x11-font-utils fontconfig ImageMagick
# rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

:

touch /etc/sysconfig/i18n

LANG="ru_RU.UTF-8"
SUPPORTED="ru_RU.UTF-8:ru_RU:ru"
SYSFONT="latarcyrheb-sun16"


RDP ( vnc):
  1. ----
  2. , ( Ctrl- Shift)
  3. « »
  4. «LibreOffice»
  5. «Russian language pack for LibreOffice» «»

, ( ).

, 1.

1:


, - . , . , 5-6 1, , !
1. N ( ).
- ( ), — RDP. , , Samba. , .
2. - (SQL ).
SQL 1 , , . , RDP 1.
1 ( ):
rpm64.tar.gz —
client.rpm64.tar.gz -
demodt.zip —

:
:
# yum install firefox libreoffice

1 :
# cd /tmp/1Csrv
# yum localinstall *.rpm

-:
# cd /opt/1C/v8.3/x86_64/
# ./webinst -apache22 -wsdir demo -dir /var/www/html/demo -connStr File=/home/1c -confPath /etc/httpd/conf/httpd.conf

-wsdir – - , ./base
-dir – web- 1 ( default.vrd);
-connStr – 1 ;
-confPath – web- apache.

Apache:
# service httpd restart
# chkconfig httpd on
# chown apache:apache /home/1C
# chown -R apache:apache /home/1C/*.clf

centos6-1c/demo 1:

image

RDP:

image

, , .

, SQL :

# yum install rpm-build wget glibc-devel bison flex readline-devel zlib-devel openssl-devel pam-devel gettext gcc make icu libicu libicu-devel firefox libreoffice

2 , addon 1 ( ). winscp .
, 9.4 ( libicu), 9.3. Python , .
[root@centos1c pgsql]# ls /tmp/pgsql/
postgresql-9.3.4_1.1C_x86_64_addon.rpm.tar.bz2
postgresql-9.3.4_1.1C_x86_64_rpm.tar.bz2
postgresql93-9.3.4-1.1C.x86_64.rpm
postgresql93-contrib-9.3.4-1.1C.x86_64.rpm
postgresql93-devel-9.3.4-1.1C.x86_64.rpm
postgresql93-docs-9.3.4-1.1C.x86_64.rpm
postgresql93-libs-9.3.4-1.1C.x86_64.rpm
postgresql93-plperl-9.3.4-1.1C.x86_64.rpm
postgresql93-server-9.3.4-1.1C.x86_64.rpm
postgresql93-test-9.3.4-1.1C.x86_64.rpm
# yum localinstall *.rpm

Postgres
# su postgres
# /usr/pgsql-9.3/bin/initdb -D /var/lib/pgsql/data --locale=ru_RU.UTF-8
# exit
# service postgresql-9.3 initdb

PostgreSQL :
# service postgresql-9.3 start
# chkconfig postgresql-9.3 on

: postgres, postgres . 123654:
# su postgres
# /usr/pgsql-9.3/bin/psql
# ALTER USER postgres WITH PASSWORD '123654';
\q
# Exit

Postgres , pg_hba.conf
# mcedit /var/lib/pgsql/9.3/data/pg_hba.conf
  :
hosts	all	all	0.0.0.0/0 	ident
 
hosts	all	all	0.0.0.0/0 	md5

, postgres:
# service postgresql-9.3 restart

http:
#./webinst -apache22 -wsdir pgbase -dir '/var/www/html/pgbase' -connStr 'Srvr="centos6-1c";Ref=”test2";' -confPath /etc/httpd/conf/httpd.conf

1:
# /etc/init.d/httpd restart
# /etc/init.d/srv1cv82 restart

1 . :
# netstat -tlnp | grep :15
tcp    	0  	0 0.0.0.0:1560 	0.0.0.0:*	LISTEN  	1508/rmngr
tcp    	0  	0 0.0.0.0:1561 	0.0.0.0:*	LISTEN  	1658/ragent
tcp    	0  	0 0.0.0.0:1562 	0.0.0.0:*	LISTEN  	1665/rphost
tcp    	0  	0 0.0.0.0:1563 	0.0.0.0:*    LISTEN  	1665/rphost
tcp    	0  	0 0.0.0.0:1540 	0.0.0.0:*    LISTEN  	1658/ragent
tcp    	0  	0 0.0.0.0:1541 	0.0.0.0:*	LISTEN  	1508/rmngr


1 ( Windows) :
image

, . .. DNS, hosts .

( windows-, RDP), .
, , http, RDP, .

:


, . , 1. , 12 — . , , production. , .

1 ( 5 ).

(-):
1 , --.
() « » « ».

USB (HASP):
USB VM.
proxmox:
# lsusb

ID: XXXX:YYYY
qm set 101 –usb0 host=XXXX:YYYY
101 — ID .
.
haspd:
# yum -y install glibc.i686
# rpm -Uvh http://download.etersoft.ru/pub/Etersoft/HASP/stable/x86_64/CentOS/6/haspd-7.40-eter9scientific.x86_64.rpm
# rpm -Uvh http://download.etersoft.ru/pub/Etersoft/HASP/stable/x86_64/CentOS/6/haspd-modules-7.40-eter9scientific.x86_64.rpm 

. , haspd-modules. haspd-modules , haspd . , () .
/etc/haspd/hasplm.conf. :
NHS_IP_LIMIT = 127.0.0.1, 172.16.2.0/24

( 172.16.2.0 ) , HASP-.

haspd:
# /etc/init.d/haspd status

haspd : xx.xx.xx.xx:1947

:


VM ( ) Proxmox:
.. - Proxmox «» NFS-. NAS-, xNIX- NFS ( ). , (backup).
1 ( ). , , , - .

( ), :
#export MYDB=postgresql://username:password@127.0.0.1:5432/mydatabase

crontab:
0 3 * * * pg_dump --dbname=$MYDB | gzip > ~/backup/db/$(date +%Y-%m-%d).psql.gz

, — NFS, , Windows .
, . . : FTP .

FTP:
#  
DATE=$(date +%Y%m%d)
FTP="ftp.domain.local"
FTPU="user"
FTPP="password"
# 
cd /root/backup
# test2
pg_dump -U postgres unf14 | gzip > $DATE-test2.pgsql.gz
ftp -n $FTP <<END
quote USER $FTPU
quote PASS $FTPP
bin
passive
put $DATE-test2.pgsql.gz
quit
END
#
rm -f $DATE-test2.pgsql.gz


:
production -.
, , webdav, davfs.
# rpm -Uvh http://repo.yandex.ru/yandex-disk/yandex-disk-latest.x86_64.rpm
# yandex-disk setup

GPG /sbin/ifup-local:
#!/bin/sh
/usr/bin/gpg-agent --daemon --use-standard-socket


:

#!/bin/bash
#  :
TIME=`date +%Y-%m-%d`
GPG_COMMAND="gpg -c -z 0 --batch --passphrase XXXXXXXXXX"
FS_FILE=/tmp/$SERVER_NAME-fs.$TIME.tar.gz.gpg
FS_PGSQL=/tmp/$SERVER_NAME-pgsql.$TIME.sql.gz.gpg

#    :
tar -cz /home/1 | $GPG_COMMAND > $FS_FILE
#    :
pg_dump --dbname=postgres://postgres:123654@127.0.0.1:5432/test2 | gzip | $GPG_COMMAND > $FS_PGSQL

#     
#   :
# curl --user user@yandex.ru:password -T "{$FS_FILE}" https://webdav.yandex.ru/
cp $FS_FILE /mnt/yandex.disk
#  - (SQL):
# curl --user user@yandex.ru:password -T "{$FS_PGSQL}" https://webdav.yandex.ru/
cp $FS_PGSQL /mnt/yandex.disk

#    30    
find /tmp/*.gpg -type f -mtime +30 -delete
#    5   -.
# curl --user user@yandex.ru:password --request DELETE https://webdav.yandex.ru/1cbase-pgsql.$OLDTIME.sql.gz.gpg
find /mnt/yandex.disk/*.gpg -type f -mtime +5 -delete

, ( SQL) . , postgres 123654 — test2. /home/1C.
, , CURL.
:
# chmod 0700 backup.sh

crontab:
# crontab -e
#      
0 0 * * * /home/backup.sh


:


:
1 .
iptables:
# chkconfig iptables off
# service iptables stop
iptables: Flushing firewall rules:                     	[  OK  ]
iptables: Setting chains to policy ACCEPT: filter      	[  OK  ]
iptables: Unloading modules:                           	[  OK  ]

:
(ragent) 1540, 1562-1591. (rmngr) 1541 1562-1591. haspd 475 1947.
. CentOS /etc/sysconfig/iptables :
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1474 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1540:1541 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1560:1591 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 475 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1947 -j ACCEPT


:
, windows , .. .
rpm releases.1c.ru/project/Platform83, :

# rpm -U *.rpm


( rpm ).

:

Windows- , Windows .
, .
:
# /opt/1C/v8.3/i386/ras --daemon cluster

ras TCP 1545.
rac ras, () .
1) help (, )
# /opt/1C/v8.3/x86_64/rac

1C:Enterprise 8.3 Remote Administrative Client Utility '1C' 1996-2015
1:

:

rac [mode] [command] [options] [arguments]

:

help .
agent
cluster
manager
server
process
service
infobase
connection
session
lock
rule
profile

2) 1
# /opt/1C/v8.3/x86_64/rac cluster list

3)
# /opt/1C/v8.3/x86_64/rac infobase create --cluster=bff5cb4a-2877-11e3-b590-d43d7eeced69 --name=user_db_empty --create-database --dbms=PostgreSQL --db-server=127.0.0.1 --db-name=user_db_empty --locale=ru --db-user=postgres --db-pwd=<> --cluster-user=admin --cluster-pwd=<>

4)
# /opt/1C/x86_64/i386/rac infobase summary list —cluster=bff5cb4a-2877-11e3-b590-d43d7eeced69 —cluster-user=admin —cluster-pwd=<>

5)
# /opt/1C/v8.3/x86_64/rac session list --cluster=bff5cb4a-2877-11e3-b590-d43d7eeced69 --cluster-user=admin --cluster-pwd=<>


PostgreSQL:

postgresql.conf . , . .


CUPS, .
RDP localhost:631
— .
— .

:


Windows Server + Terminal CALs, MS SQL Server + Connection CALs. 1, Linux- ! , , , ( ), windows- .
, ( ), . , , Proxmox , .

P.S: CentOS 6, 7? 1 http apache 2.2. , 7- , polkitd.
P.P.S: , , .

, !

Source: https://habr.com/ru/post/282852/


All Articles