📜 ⬆️ ⬇️

Ubuntu Server 10.04 LTS i386, PostgreSQL + 1C patch, 1c server + web interface: build, install, configure

I do not know whether it will be someone.


Judging by the reaction to habrahabr.ru/blogs/linux/107321 - this is necessary.

UPD 1 Start

')
From the comments below, thanks to OldFornit

1. texlive-binaries - it is likely that there is no need to install this package.

2. “Yes, the Linux platform does not always work stably, the server often“ crashes ”, no one really writes different versions.
The reason is known - the fragmentation of memory. Remarkably helps to limit the lifetime of one workflow / memory limit per workflow (around 1.6G). Suddenly! There can be (and should be) more than one workflow. ”

3. “Yes, and without a description of tuning postgres, or at least a reference to any article on this issue, there is no point in setting up this bundle.

wiki.etersoft.ru/PostgreSQL/Optimum?v=148t

Etersoft sell support for PostgreSQL.


UPD 1 End


UPD 2 Start


one.
After being changed
kernel.shmmax = 143217728
kernel.shmall = 143217728
It is necessary to apply them by the command:
sysctl -p

2
It may be necessary to create
symlinks on
libreadline.so.6

ln -s /lib/libreadline.so.6 /lib/libreadline.so.5

3
texlive-binaries are not needed, just install

aptitude install t1utils libt1-5

and ttf2pt1

altruistic.lbl.gov/mirrors/ubuntu/pool/universe/t/ttf2pt1

(taken from here pg1c.ru/?page_id=173 )


UPD 2 End


Therefore, do not judge strictly, if someone does not like Ubuntu or 1C, or "both".

[1] The source material is presented on www.opennet.ru/cgi-bin/openforum/vsluhboard.cgi?az=show_thread&omm=0&om=67768&forum=vsluhforumID3

This hand-made article is addition and correction.

[2] In addition, a number of materials from the network were used, in particular, openstar.com.ua/blog/installation-1-linux-postgresql .

Many thanks to Ailant (http://ailant.com.ru/) who smoked all the necessary mana and offered the original RPM and DEB build.

Also personal “respect and respect” by Igor Vershinin (Igor Vershinin) from the same Ailant.

As well as the guy who made the assembly under i386 as described by Ailant, most likely his name is Valery.

Material on locale.gen is taken from the 1C knowledge base.

Perhaps we proceed?

So, our task is to install:
  1. Ubuntu Server 10.04 LTS.
  2. 1C Server.
  3. PostgreSQL server compiled specifically for 1C.

Perform the initial setup.
We will download and install the server, when installing, we will select LAMP and SAMBA immediately.
Although we don’t need PHP and MySQL, it’s not enough, then suddenly we’ll decide on a web server on this machine.
The first commands in the server after installation:
sudo -i
apt-get install mc
apt-get install ntp
apt-get update
apt-get upgrade
apt-get dist-upgrade
echo kernel.shmmax = `echo 128 * 1024 * 1024 | bc` >> /etc/sysctl.conf
echo kernel.shmall = `echo 128 * 1024 * 1024 | bc` >> /etc/sysctl.conf

Checking:
nano /etc/sysctl.conf

At the very end should be:
kernel.shmmax = 143217728
kernel.shmall = 143217728

I do not know whether it is necessary or not, I just followed the recommendations in [2], just in case I put it.
apt-get install libxslt1.1 libxml2

Now what exactly is needed:
echo en_US ISO-8859-1 >> /etc/locale.gen
locale-gen
Generating locales ...
ru_RU.UTF-8 ... done
en_US.ISO-8859-1 ... done
Generation complete.

Let's make two symbolic links, without which 1C: Enterprise cannot work with the DBMS:
ln -s /usr/lib/locale/en_US.utf8 / usr / lib / locale / en_US
ln -s / usr / share / locale / en / usr / share / locale / en_US



Now install PostgreSQL
Some more dependencies:
apt-get install postgresql-common postgresql-client-common libicu42 libossp-uuid16

Further, we collect PostgreSQL as it is specified in the instruction OpenNet.
Download from http://v8.1c.ru/overview/postgres_patches_notes.htm all three patches of the latest versions (there is still RPM, but it will not work for us).
Version 8.4.1

The fact that version 8.4.1 is not at all scary, because according to OpenNet information, “ all minor fixes do not affect the fact that the 1C patch is patched. “
>> „Rename patches by adding“ 20- ”,“ 21- ”and“ 22- ”before the name, i.e. we bring them to the form: 20-1c_FULL_84-0.19.2.patch, 21-postgresql-1c-8.4 .patch, 22-applock-1c-8.4.1.patch. “
Create a folder 1C, if you have not already done so.
Download PostgreSQL into it:
apt-get source postgresql

>> „After downloading, the archives will be automatically unpacked, Ubuntu-specific patches will be applied (which is very good, as the final assembly will be“ native ”). Then copy our patches to the "/ debian / patches /" directory. Next, we have to fix the three files responsible for the correct assembly of the package. All three files are contained in the “debian” directory. "
Those. if you do everything in steps, it will be something like "/ 1c / debian / patches".
>> The changelog file. It is responsible for the correct name of the package after assembly. Add the following lines to the beginning of the file:
postgresql-8.4 ([your prefix so that the version is higher than 8, for example 18] 8.4.4- [as you want to call the assembly] -0ubuntu10.04) lucid; urgency = low
* Apply 1C patch for PostgreSQL (from 8.4.1 version)
- add mchar, fulleq, fasttrun
- [First Name] [Last Name] <e-mail> [date in correct format]
Look carefully at this file and you will understand that first comes the full name of the assembly, then, after the asterisk, what exactly changes, then a description, a more detailed one, then who specifically commits patches and what was done.
Thus, our version will be [the figure you entered at the beginning, for example]: 18.4.4, so that in the future it will not update itself when the system is updated.
If new versions come out, you can always do the same by rebuilding PostgreSQL.
Yes, version 9 is now released, it’s good that it isn’t “downloaded automatically” for Ubuntu 10.04 LTS, since it’s impossible to say anything about its compatibility.
>> The next file is "control".
It is necessary to add a dependency on the library “libicu42” (required for the patch from “1C”).
In the section "Build-Depends" (at the beginning of the file) at the end of the list we add ", libicu-dev".
The whole line will look like this:

bison, flex, docbook-utils, openjade, docbook, libicu-dev


And the last file is “postgresql-contrib-8.4.install”. It is necessary to add lines with the names of 1C-ov modules: mchar, fulleq and fasttrun. After the lines:
usr / lib / postgresql / 8.4 / lib / pg_stat_statements.so
usr / lib / postgresql / 8.4 / lib / citext.so
usr / lib / postgresql / 8.4 / lib / btree_gin.so

need to add:
usr / lib / postgresql / 8.4 / lib / mchar.so
usr / lib / postgresql / 8.4 / lib / fulleq.so
usr / lib / postgresql / 8.4 / lib / fasttrun.so

But that's not all.
>> Since we collect on a 32-bit i386 computer, we need to prescribe the correct “date handling”.
This is indicated in the / debian / rules file; in fact, this is a regular makefile that indicates the build order.
It has in line 31 the option "--enable-integer-datetimes", it must be replaced with "--disable -..."
Now you need to fix the patch itself from 1C, the file that is the largest in size, because
>> Update patch 0.19.3 from 1C was released with a small impact, instead of line 2118:
+ LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
it is used with one modified word, namely:
+ LANGUAGE C RETURNS NULL ON NULL INPUT VOLATILE;
Now "the adaptation operation can be considered complete ."
We compile as indicated in the article, via “pbuilder” (>> “For more information about this, see https://wiki.ubuntu.com/PbuilderHowto ”).
To do this, we set, in fact, his and one more necessary lib.
apt-get install pbuilder cdbs

We create the assembly stand:
pbuilder create

We update the assembly stand (preferably each time before compiling):
pbuilder update

Moving to the directory where our PostgreSQL sources are located and “talking”:
pdebuild

>> Build has begun. For the first time, about 500 megabytes will be stretched along dependencies, you have to be ready for this. Or collect on the unlim channel (at home, for example). Further packages are cached. We use the apt-proxy package, which also knows how to do it. For companies where there is more than one server, I highly recommend.
The assembly runs smoothly and calmly. At the end in the directory "/ var / cache / pbuilder / result" will be collected packages.
Everything is just like that.
Take the resulting packages somewhere from / var.
As root (sudo -i) do the installation.
And, actually, the installation of PostgreSQL, the sequence matters, if you use the TAB button for autocompletion, then typing these long names is very simple:
dpkg -i libpq5_ [the name of your build, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
dpkg -i libpgtypes3_ [name of your build, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
dpkg -i postgresql-client- [name of your assembly, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
dpkg -i postgresql-8.4_ [the name of your build, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
dpkg -i postgresql-contrib-8.4_ [the name of your build, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb

Everything, PostgreSQL is installed, it was launched on the fourth package.

We just check:
ps aux | grep post

Verify that PostgreSQL always starts after a reboot:

update-rc.d postgresql-8.4 defaults

I have written
System start / stop links for /etc/init.d/postgresql-8.4 already exist.

We check that PostgreSQL has got up "as it should," see if there is:
/etc/postgresql/8.4/main/pg_hba.conf

At the same time, we fix pg_hba.conf so that PostgreSQL can be easily "visible on the network."
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# local all all ident sameuser # WAS
local all all trust # BECAME
#host all all 0.0.0.0/0 md5 # WAS
host all all 0.0.0.0/0 trust # BECAME

From the point of view of security, this, of course, is wrong, but it works.
Now we will correct the password on PostgreSQL, after all we don't know it yet?
sudo passwd postgres

This, of course, will not set a password for the database, but will set a password for the DBMS, we will see it over the network.

Now, in fact, the installation of 1C.
Initial preparation includes:
apt-get install imagemagick msttcorefonts libgsf-1-114 texlive-binaries

We download 1C from the site users.v8.1c.ru, of course, this applies to those who have access there.
You can try to search for ITS disks or online ...
Further, everything is quite standard and trite, consistently set:
1c-enterprise82-common_8.2.12-92_i386.deb
1c-enterprise82-common-nls_8.2.12-92_i386.deb
1c-enterprise82-server_8.2.12-92_i386.deb
1c-enterprise82-server-nls_8.2.12-92_i386.deb
1c-enterprise82-ws_8.2.12-92_i386.deb
1c-enterprise82-ws-nls_8.2.12-92_i386.deb
1c-enterprise82-crs_8.2.12-92_i386.deb
1c-enterprise82-crs-nls_8.2.12-92_i386.deb

Check that everything is fine, that everything is established:
/opt/1c/v8.2/i386/utils/config_server

Must work out without issuing any messages.
If, after all, it gives out something, then we follow the instructions, he swears at what he is missing.
>> Usually it does not indicate the name of the packages, but the missing files. You can find out what package they are in via “apt-file search”.

We make it possible to start after a reboot and run:

update-rc.d srv1cv82 defaults
service srv1cv82 start
ps aux | grep 1c

On behalf of the user "usr1cv82" three processes should be launched. If there are not three processes, but one (for some reason this sometimes happens, but only during the initial launch), then we crash everything in the / home / usr1cv82 directory:

service srv1cv82 stop
banging
service srv1cv82 start

Reboot and check that everything works:
ps aux | grep apache
ps aux | grep post
ps aux | grep 1c


Now let's deal with the web service:
Usually, each client connection wants a key, the same applies to the web service, each web client takes 1 “free license”.
I had no desire to bother with installing HASP LM even under Ubuntu. Alladin site only TAR.
I went around. From a Windows computer on which platform 8.2 is installed, the file is taken:
C: \ Program Files \ 1cv82 \ conf \ nethasp.ini

FILE is located in
/opt/1c/v8.2/i386/conf/nethasp.ini

In the file correct
;; NH_TCPIP = Enabled or Disabled; Use the TCP / IP protocol

on
NH_TCPIP = Enabled; Use the TCP / IP protocol

this is about line 24.

And 110 line
;; NH_SERVER_ADDR = <Addr1>, <Addr2>; IP addresses of all the NetHASP

on
NH_SERVER_ADDR = IP of the computer where HASP LM is installed

After that, the web service will begin to see the license.

Now the web itself.
I created the folder "/ 1c / web /".
I put the default.vrd file in it as follows:
<? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  1. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  2. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  3. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  4. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  5. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  6. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  7. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
  8. <? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" encoding ="UTF-8" ? > < point xmlns ="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" base ="/unf" ib ="Srvr=&quot;[ ]&quot;;Ref=&quot;[ ]quot;;" > < ws enable ="false" /> </ point > * This source code was highlighted with Source Code Highlighter .


The following line was added to the virgin /etc/apache2/httpd.conf:
LoadModule _1cws_module "/opt/1C/v8.2/i386/wsap22.so"

And in / etc / apache-2 / sites-enabled / 000-default
  1. Alias ​​/ 1s "/ 1c / web"
  2. < Directory "/ 1c / web /" >
  3. AllowOverride None
  4. Options none
  5. Order allow, deny
  6. Allow from all
  7. SetHandler 1c-application
  8. ManagedApplicationDescriptor "/1c/web/default.vrd"
  9. </ Directory >
* This source code was highlighted with Source Code Highlighter .


It is important that both apache and 1C have access to the folder "/ 1c / web /".
I entered clumsily:
chmod 777 -R / 1c

Because long before that, he had already managed to “kill” security with a thing like:
[share]
comment = All Share
browseable = yes
path = / 1c / share
guest ok = yes
read only = no
create mask = 0777
directory mask = 0777

In /etc/samba/smb.conf.
Yes, the Linux platform does not always work stably, the server often “crashes”, no one writes different versions.
To avoid this, we use a typical crutch:
  1. We take the starter script 1C (for those in the tank: "/etc/init.d/srv1cv82"), copy somewhere to my daddy (I have "/ 1c / script").
  2. We rule it as we please, it is desirable to display messages in the log, you will figure it out by trial and error ...
  3. We hang on crontab (man crontab) as root (sudo -i) (you can just hang up with service srv1cv82 start, don't forget about start!)
    crontab -e
    * / 5 * * * * service srv1cv82 start

If someone is interested in "flat" bases 8.2 in the http-Intranet, then they need to:
  1. The full ball type described above is for configuring.
  2. Accordingly, the configuration itself is in this ball.
  3. Apache settings themselves do not change, default.vrd changes:

  1. <? xml version = "1.0" encoding = "UTF-8" ? >
  2. < point xmlns = "http://v8.1c.ru/8.2/virtual-resource-system"
  3. xmlns: xs = "http://www.w3.org/2001/XMLSchema"
  4. xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
  5. base = "/ new"
  6. ib = "File = & quot; [path to / 1c / baza type balls] & quot ;;" >
  7. < ws enable = "false" />
  8. </ point >
* This source code was highlighted with Source Code Highlighter .


On this, sort of, everything.

And just in case:
  1. Mounting available Windows resources is as follows: sudo smbmount \\\\ [computer name] \\ [resource name] / mnt -o username = [username], password = [password], [rw?], Iocharset = utf8
  2. / etc / network / interfaces:
    iface eth0 inet static
    address 192.168.XXX.XXX
    netmask 255.255.255.0
    gateway 192.168.XXX.XXX
    as well as looking to /etc/resolv.conf was "everything is OK"
  3. Do not forget about /etc/.wgetrc, /etc/apt/apt.conf, / etc / environment if we have a proxy, rule https_proxy http_proxy and ftp_proxy by the format = http: // [user]: [pass] @ [IP: port ]
  4. Do not forget that for Samba Share you also need to give chmod
  5. Do not forget that strictly speaking, apache knows nothing about / opt, it may well be that you also need to give chmod


I note that everything is in the console: we use the simple truth that “GUI is for the faint of heart”, and the machine is on our virtual machine :).

Now for sure.

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


All Articles